forever does not start on server reboot [duplicate]

◇◆丶佛笑我妖孽 提交于 2020-01-03 03:45:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!