Skip to content

Instantly share code, notes, and snippets.

@my-janala
Last active October 13, 2016 09:02
Show Gist options
  • Save my-janala/d595c1bbeef45f4febfcf20598c8465a to your computer and use it in GitHub Desktop.
Save my-janala/d595c1bbeef45f4febfcf20598c8465a to your computer and use it in GitHub Desktop.
Creating auto-startup script using pm2.
$ pm2 startup ubuntu
[PM2] You have to run this command as root. Execute the following command:
sudo su -c "env PATH=$PATH:/opt/node-v4.3.1-linux-x64/bin pm2 startup ubuntu -u jenkins --hp /home/jenkins"
Now run the command as root as it says here http://pm2.keymetrics.io/docs/usage/startup/.
Then run
$ pm2 save
as the user running the node service. In my case, it's jenkins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment