Created
October 2, 2012 21:10
-
-
Save ngryman/3823330 to your computer and use it in GitHub Desktop.
Post: Using upstart with forever to manage your node.js application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!upstart | |
description "your fancy description that no one will see ;)" | |
author "Your Name <youremail@fqdn>" | |
# start on every run level, 2 is the one on Ubuntu | |
start on runlevel [2345] | |
# stop on halt, maintenance or reboot | |
stop on runlevel [016] | |
# start our application with the user `user` | |
exec sudo -u user -i NODE_ENV=production forever start /home/user/path/to/server >> /home/user/path/to/server/syslog 2>&1 | |
# starting log | |
pre-start script | |
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> /home/user/path/to/server/syslog 2>&1 | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why this script has .sh extension? It needs to be placed at /etc/init?