Skip to content

hisco/forever-process

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published