Created
December 31, 2013 20:46
-
-
Save unixpickle/8202073 to your computer and use it in GitHub Desktop.
A nodule for running and stopping an HTTP service
This file contains 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
if process.argv.length != 4 | |
console.log 'Usage: coffee main.coffee <start cmd> <stop cmd>' | |
process.exit 1 | |
{exec} = require 'child_process' | |
stopApache = -> | |
exec process.argv[3], -> | |
process.exit() | |
process.on 'SIGINT', stopApache | |
process.on 'SIGTERM', stopApache | |
exec process.argv[2] | |
loopFn = -> | |
setTimeout loopFn, 100000 | |
loopFn() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment