mecano
Version:
Common functions for system deployment.
17 lines (14 loc) • 504 B
JavaScript
// Generated by CoffeeScript 1.11.1
var exec;
module.exports = function(ssh, pidfile, callback) {
var child;
if (arguments.length === 4) {
throw Error('Argument "options" removed');
}
child = exec(ssh, "if [ ! -f '" + pidfile + "' ]; then exit 1; fi\nif ! kill -s 0 `cat '" + pidfile + "'`; then\n rm '" + pidfile + "';\n exit 2;\nfi");
child.on('error', callback);
return child.on('exit', function(code) {
return callback(null, code === 0);
});
};
exec = require('ssh2-exec');