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); |