I have a node app that I would like to run at startup but I cannot get it to work. I am running Ubuntu 14.04. The first command starts the process and works as intended but when I run pm2 startup
and pm2 save
from below and reboot the box I have no luck with the app launching at boot.
# Start the process
NODE_ENV="production" pm2 start /home/expressjs/app_name/app.js -u expressjs --watch --name "app_name"
# Create a startup script and save the process.
sudo env PATH=$PATH:/usr/local/bin pm2 startup ubuntu -u expressjs
pm2 save