So I have Node/Express app running on an Amazon Linux Ec2 instance (VPC). The path to my node app is as follows /home/ec2-user/server/server.js
If I run which forever
I get
~/.nvm/versions/node/v6.11.5/bin/forever
If I run the following command the node app starts and works.
forever start server.js
If I reboot the server or stop/start then server.js will not run. I have to run forever start server.js from the terminal.
I tried the following ways to get my app to restart with forever and it will NOT restart.
rc.local
forever start ../home/ec2-user/server/server.js
./.nvm/versions/node/v6.11.5/bin/forever start ../home/ec2-user/server/server.js
/init/kue.conf
description "start kue server"
start on filesystem and started networking
stop on shutdown
script
touch /var/log/forever.log
touch /var/log/stat_out.log
touch /var/log/stat_err.log
rm /var/log/forever.log
rm /var/log/stat_out.log
rm /var/log/stat_err.log
forever start -l /var/log/forever.log -o /var/log/stat_out.log -e /var/log/stat_err.log /home/ubuntu/code/StatKue/server.js
end script
crontab -e
forever start /server/server.js
None of these works and I have spent 3 days trying to get forever to restart my app on reboot?