How to start an entirely new process in node.js (not child)?

You can use the natively provided child process facility: http://nodejs.org/api/child_process.html

And use the unix "nohup" command to keep the spawned process alive even if the parent process died.


You can spawn a child process in a detached state, ignore the outputs, and remove the child from the parents event loop with child.unref().

This code will start someScript.sh, and exit while keeping someScript.sh running.

var spawn = require('child_process').spawn;

var child = spawn(__dirname + '/someScript.sh', [], {
    detached: true ,
    stdio: [ 'ignore', 'ignore', 'ignore' ]
});

child.unref();

For more detailed information and alternatives (such as logging output / etc), take a look at the documentation for spawn. There are other examples there as well:

http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options


Haven't got too much information but it seems like either spawn, exec or fork options for child process. The other option would be a shared port, both options are clarified further here: http://craigbrookes.com/2012/03/17/multiple-processes-in-nodejs/