forever-process
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Forver process

forever-process makes sure that your child process scripts will run forever.

Simple usage

const {ForeverChildProcess} = require('forever-process');
const foreverChildProcess = new ForeverChildProcess();
 
foreverChildProcess.on('child' , (child)=>{
    child.on('data' , (msg)=>{
        console.log(msg.toString())
    })
})
foreverChildProcess.fork(`${__dirname}/fail-process`);
 

Advanced usage

 
const {ForeverChildProcess} = require('forever-process');
const foreverChildProcess = new ForeverChildProcess({
    //You can overide any of the following settings
 
    fork : ()=>{ /* You can overide, just remeber to return the child instance */},
    spawn : ()=>{ /* You can overide, just remeber to return the child instance */},
    minUptime : 1000,
    spinSleepTime : 30000,
    spinIdentifyTime : 30000,
    spinCounter : 8
});
 
foreverChildProcess.on('child' , (child)=>{
    child.on('data' , (msg)=>{
        console.log(msg.toString())
    })
})
foreverChildProcess.fork(`${__dirname}/fail-process`); 
 

License

MIT

Package Sidebar

Install

npm i forever-process

Weekly Downloads

5

Version

1.1.0

License

MIT

Unpacked Size

9.85 kB

Total Files

8

Last publish

Collaborators

  • hiscojs