Skip to content

Instantly share code, notes, and snippets.

@xively-gists
Last active December 17, 2015 16:58
Show Gist options
  • Save xively-gists/5642234 to your computer and use it in GitHub Desktop.
Save xively-gists/5642234 to your computer and use it in GitHub Desktop.
Upstart config for Xively Raspberry Pi tutorial
# Upstart config file for Xively Raspberry Pi tutorial
#
# This file should be saved into /etc/init/xively.conf
description "xively tutorial example"
# start the daemon on system boot, and stop on shutdown
start on runlevel [2345]
stop on runlevel [!2345]
# environment variables that will be passed to the script - set values correctly for your environment
env API_KEY=YOUR_API_KEY
env FEED_ID=YOUR_FEED_ID
env USER=pi
env VIRTUALENV=.envs/xively
env DAEMON_ROOT=/home/$USER/xively_tutorial
env DEBUG=true
env DAEMON_EXEC=$DAEMON_ROOT/$VIRTUALENV/bin/python
# respawn the daemon should it terminate unexpectedly
respawn
# the actual script we'll be executing
script
chdir $DAEMON_ROOT
exec $DAEMON_EXEC xively_tutorial.py
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment