Skip to content

Instantly share code, notes, and snippets.

@magician11
Last active April 30, 2018 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magician11/942c2a941b4a394d35d186d1009a703b to your computer and use it in GitHub Desktop.
Save magician11/942c2a941b4a394d35d186d1009a703b to your computer and use it in GitHub Desktop.
How to automatically restart a Node.js script (with forever) on a server reboot
NODE_ENV=production
PATH=/root/.nvm/versions/node/v8.11.1/bin:$PATH
@reboot cd /var/server/script-directory && /root/.nvm/versions/node/v8.11.1/bin/forever start myscript.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment