proc-mgr
v1.0.3
Published
##### 一个启停守护进程的库
Downloads
6
Readme
proc-mgr
一个启停守护进程的库
example:
const http = require('http');
const pm = require('proc-mgr');
http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello World\n');
}).listen(8088, '127.0.0.1', () => {});
const cp1 = pm.start('sh xxx.sh');
const cp = pm.start('python', ['-m', 'SimpleHTTPServer', '8080']);
cp.on('error', (err) => {
console.log('child process error: ');
});
cp.on('exit', (code) => {
console.log(`child process stoped ${code}`);
cp = pm.restart(cp);
});