I'm using Forever in my node.js app. I'm starting a child process like:
var forever = require('forever');
child = new (forever.Monitor)('path/to/my/server.js', {
max: 3,
silent: true,
options: []
});
child.start();
How can I find out the pid of that child process?
var forever = require('forever');
child = new (forever.Monitor)('path/to/my/server.js', {
max: 3,
silent: true,
options: []
});
child.on('start', function(process, data) { console.log(data.pid); });
child.start();
Listen to the 'start' event, and it's the pid property of the second argument passed to that callback function.