node-init
node-init copied to clipboard
Synchronous alternatives
I've added synchronous calls to this module (for running only) as the daemon module does not support forking unless it is done during the first tick of v8. And the only way to ensure this is happening is synchronous calls.
Sample init.d script for a forking process:
if (require('cluster').isMaster) {
require('init').simple({
pidfile : '/var/run/sample.pid',
logfile : '/var/log/sample.log',
runSync : function() {
// ... master code here
}
});
} else {
// ... worker code here
}