Last active
December 20, 2015 06:39
-
-
Save blmarket/6087117 to your computer and use it in GitHub Desktop.
Node.js daemon configuration using upstart
This file contains hidden or 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 config | |
author "blmarket" | |
description "service-admin daemon upstart for ubuntu" | |
start on runlevel[2345] | |
stop on runlevel[!2345] | |
respawn # restart task if failed | |
respawn limit 5 20 # respawn up to 5 times if failed(with 20 sec of interval) | |
# service update from git repository and install dependencies. | |
pre-start script | |
export HOME="/home/ubuntu" | |
cd $HOME/service-admin | |
exec sudo -u ubuntu sh -c 'git pull && npm install' | |
end script | |
# run actual service. | |
exec node /home/ubuntu/service-admin/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment