1.0.3 • Published 8 years ago

proc-mgr v1.0.3

Weekly downloads
1
License
ISC
Repository
-
Last release
8 years ago

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