Skip to content

Instantly share code, notes, and snippets.

@yusufhm
Created September 14, 2015 01:43
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 yusufhm/c547f2f9248416c54285 to your computer and use it in GitHub Desktop.
Save yusufhm/c547f2f9248416c54285 to your computer and use it in GitHub Desktop.
NPM Upstart Script
description "Turn `project name` bot into a daemon"
author "Yusuf Hasan Miyan"
start on runlevel [2345]
stop on runlevel [016]
script
echo $$ > /var/run/project-name-bot.pid
chdir /path/to/project-name-bot
exec sudo -u $user /usr/bin/npm start
end script
pre-stop script
rm /var/run/project-name-bot.pid
end script
respawn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment