src/fork.js

changeset 4
3de96d11e417
parent 0
eb6d4ce6fd78
equal deleted inserted replaced
0:2386daed63d0 1:8a7fa7fef353
45 45
46 // configure a child process to daemonize 46 // configure a child process to daemonize
47 var childproc = new (forkserv.Monitor)('app.js', { 47 var childproc = new (forkserv.Monitor)('app.js', {
48 max: 4, 48 max: 4,
49 silent: true, 49 silent: true,
50 pidFile: 'mdnsgw.pid', 50 pidFile: '/tmp/mdnsgw.pid',
51 logFile: 'mdnsgw.log', 51 logFile: '/tmp/mdnsgw.log',
52 outFile: 'mdnsgw.out', 52 outFile: '/tmp/mdnsgw.out',
53 errFile: 'mdnsgw.err', 53 errFile: '/tmp/mdnsgw.err',
54 options: [] 54 options: []
55 }); 55 });
56 56
57 childproc.on('exit', function () { 57 childproc.on('exit', function () {
58 console.log('app.js has exited after 4 restarts'); 58 console.log('app.js has exited after 4 restarts');
59 }); 59 });
60 60
61 // fork a child 61 // fork a child
62 childproc.start(); 62 childproc.start();
63
64 //// daemonize by exit
65 //that doesn't work
66 //process.exit(0);

mercurial