|
@@ -121,31 +121,50 @@ exports.stop = function (options, callback) { |
|
|
}, |
|
|
function removePid(next) { |
|
|
fs.unlink(options.pidFile, next.bind(null, null)); |
|
|
}, |
|
|
function blanketKill(next) { |
|
|
killNet(options, next); |
|
|
} |
|
|
], callback); |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
|
|
|
var killNet = function killNet (options, callback) { |
|
|
var logger = options.logger; |
|
|
|
|
|
var args = ['pkill', '-9', '-U', 'solenoid']; |
|
|
|
|
|
runChild(logger, args, callback); |
|
|
|
|
|
}; |
|
|
|
|
|
// |
|
|
// Spawn a child process and output the results |
|
|
// |
|
|
var runChild = function runChild (logger, args, callback) { |
|
|
var command = args.shift(), |
|
|
child = spawn(command, args); |
|
|
|
|
|
child.stdout.on('data', function (d) { logger.info('' + d) }); |
|
|
child.stderr.on('data', function (d) { logger.info('' + d) }); |
|
|
child.on('exit', callback.bind(null, null)); |
|
|
}; |
|
|
|
|
|
var clean = exports.clean = function clean(options, callback) { |
|
|
var commands = [ |
|
|
['pkill', '-9', 'aeternum'], |
|
|
['pkill', 'forza'], |
|
|
['rm', '-rf', options.pidFile || path.join(process.env.HOME, 'app.pid')], |
|
|
['rm', '-rf', options.runDir || ('/' + path.join('opt', 'run'))] |
|
|
]; |
|
|
|
|
|
var logger = options.logger; |
|
|
|
|
|
logger.info('Cleaning ' + options.runDir); |
|
|
async.forEachSeries(commands, function (args, next) { |
|
|
var command = args.shift(), |
|
|
child = spawn(command, args); |
|
|
|
|
|
child.stdout.on('data', function (d) { logger.info('' + d) }); |
|
|
child.stderr.on('data', function (d) { logger.info('' + d) }); |
|
|
child.on('exit', next.bind(null, null)); |
|
|
}, callback); |
|
|
async.forEachSeries( |
|
|
commands, |
|
|
runChild.bind(null, logger), |
|
|
killNet.bind(null, options, callback) |
|
|
); |
|
|
}; |
|
|
|
|
|
var fetch = exports.fetch = function fetch(options, callback) { |
|
|