Skip to content

Instantly share code, notes, and snippets.

@sh1mmer
Created August 24, 2010 03:09
Show Gist options
  • Save sh1mmer/546847 to your computer and use it in GitHub Desktop.
Save sh1mmer/546847 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
// the upstart job to check the status of
var job = 'node';
var spawn = require('child_process').spawn,
status = spawn('status', [job]),
output = "";
status.stdout.on('data', function(data) {
output += data;
});
status.on('exit', function(code) {
if (output.indexOf('start') !== -1) {
console.log('status ok the ' + job + ' job is running');
} else {
console.log('status err the ' + job + ' job is not running');
}
});
status.stdin.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment