Question

I have added some processes to forever (forever start script.js) but when server reboot forever list is empty and of course none of them was started. Any idea to fix this because I thought forever was made to run for ever...

Was it helpful?

Solution

The simplest way is to start forever from /etc/rc.local. There are more complete ways to do this so you can start/stop/etc... or use something like monit (but this duplicates what forever does).

You also have to consider running forever with a user that is not root.

start_forever.sh

cd /absolute/path/to/project
/absolute/path/to/forever -m 5 examples/error-on-timer.js&

then in /etc/rc.local

sudo -u SOME_USER /absolute/path/to/start_forever.sh
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top