Answer the question
In order to leave comments, you need to log in
How to start independent process from node?
Good afternoon!
The essence of the question is the following, how to start a new process from the node.js process, which will continue to run even after the termination of the node?
In details. There is a controller process that should run processes that interact with TCP sockets. New processes should be launched in such a way that even after the controller process is closed, they would remain alive and restarting the controller should pick up existing processes and continue to manage them: kill, create new ones, etc.
Answer the question
In order to leave comments, you need to log in
#!/usr/bin/env node
require('child_process').exec('name &', function (err) {
if (err) {
console.log('Can\'t start child process.');
process.exit(1);
}
console.log('Child process is started.');
});
#!/usr/bin/env node
require('child_process').exec('name &', function (err) {
if (err) {
console.log('Can\'t start child process.');
process.exit(1);
}
console.log('Child process is started.');
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question