问题
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...
回答1:
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
来源:https://stackoverflow.com/questions/15013248/forever-does-not-start-on-server-reboot