mecano
Version:
Common functions for system deployment.
26 lines (23 loc) • 717 B
JavaScript
// Generated by CoffeeScript 1.9.1
var execute;
module.exports = function(options, callback) {
if (!options.name) {
return callback(new Error("Missing required option 'name'"));
}
return this.execute({
cmd: "service " + options.name + " status",
code_skipped: [3, 1],
shy: true
}, function(err, started) {
if (err) {
return callback(err);
}
return options.db["mecano.service." + options.name + ".status"] = started ? 'started' : 'stopped';
}).execute({
cmd: "service " + options.name + " stop",
not_if: function() {
return options.db["mecano.service." + options.name + ".status"] === 'stopped';
}
}).then(callback);
};
execute = require('./execute');