Skip to content

Instantly share code, notes, and snippets.

@RaviTezu
Created April 26, 2016 18:46
Show Gist options
  • Save RaviTezu/5286ee26d9851c9bbf4448c7bd265371 to your computer and use it in GitHub Desktop.
Save RaviTezu/5286ee26d9851c9bbf4448c7bd265371 to your computer and use it in GitHub Desktop.
###########################################
#### UPSTART SCRIPT FOR <SERVICE NAME> ####
###########################################
start on filesystem and started networking
stop on shutdown
author "<Organization name> or <Person name>"
description "Upstart script for running <service name>"
version "0.1"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
env PYTHON_HOME=/root/.virtualenvs/<virtual-env-name>
env NAME=<service-name?>
env UID=root
env GID=root
env SCRIPT=/usr/bin/<script-name.py>
script
exec start-stop-daemon --start --make-pidfile --pidfile /var/run/$NAME.pid --name $NAME -c $UID:$GID -x $PYTHON_HOME/bin/python $SCRIPT >> /var/log/upstart/$NAME.log 2>&1
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment