Nemo's Parental Misguidance

    proc-mgr

    1.0.3 • Public • Published

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

    Keywords

    none

    Install

    npm i proc-mgr

    DownloadsWeekly Downloads

    2

    Version

    1.0.3

    License

    ISC

    Last publish

    Collaborators

    • yuzhigang33