foreversd / forever-monitor

The core monitoring functionality of forever without the CLI
MIT License
1.16k stars 178 forks source link

Monitor a background non node js application #162

Open NkV7 opened 6 years ago

NkV7 commented 6 years ago

Monitoring a background C++ application that is started by a bash script. The following is saved as test.js

var forever = require('forever-monitor'); process.stdin.resume();

var child = forever.start([ '/bin/bash', '-c', '/bin/myshellscript start' ], { max: 5, silent: true });

forever start test.js works fine and spawns up child processes started from shell script. Also works when we crash or pskill the script.

forever stop test.js does not provide a way like stop events to kill the child process. Any sample scripts would be great.

Thanks

NkV7 commented 6 years ago

In addition I have also tried the following method. sudo forever start -c /bin/bash mybash.sh start Again, the start process works like magic, but the stop process is two step sudo forever list sudo forever stop pid

My question is with both command line and forever-monitor API, is there a better way to stop the process and child process.

sudo forever stop -c /bin/bash mybash.sh stop