Created
August 24, 2010 03:09
-
-
Save sh1mmer/546847 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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