Skip to content

Instantly share code, notes, and snippets.

@blmarket
Last active December 20, 2015 06:39
Show Gist options
  • Save blmarket/6087117 to your computer and use it in GitHub Desktop.
Save blmarket/6087117 to your computer and use it in GitHub Desktop.
Node.js daemon configuration using upstart
# 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