-
-
Save mreis1/faa379e6b3354becbc1cbe17cca7343d to your computer and use it in GitHub Desktop.
Restart itself (node.js app) https://stackoverflow.com/questions/25247250
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 | |
"use strict"; | |
console.log("This is pid " + process.pid); | |
setTimeout(function () { | |
process.on("exit", function () { | |
require("child_process").spawn(process.argv.shift(), process.argv, { | |
cwd: process.cwd(), | |
detached : true, | |
stdio: "inherit" | |
}); | |
}); | |
process.exit(); | |
}, 5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment