Skip to content

Instantly share code, notes, and snippets.

@jondot
Created September 13, 2011 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jondot/1213708 to your computer and use it in GitHub Desktop.
Save jondot/1213708 to your computer and use it in GitHub Desktop.
inits
#! /bin/sh
# /etc/init.d/carbon
# see http://tompurl.com/2011/08/12/installing-graphite-on-ubuntu-10-4-lts/
# Some things that run always
touch /var/lock/carbon
GRAPHITE_HOME=/opt/graphite
CARBON_USER=www-data
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting script carbon "
su $CARBON_USER -c "cd $GRAPHITE_HOME"; su $CARBON_USR -c "$GRAPHITE_HOME/bin/carbon-cache.py start"
;;
stop)
echo "Stopping script carbon"
su $CARBON_USER -c "cd $GRAPHITE_HOME"; su $CARBON_USR -c "$GRAPHITE_HOME/bin/carbon-cache.py stop"
;;
*)
echo "Usage: /etc/init.d/carbon {start|stop}"
exit 1
;;
esac
exit 0
description "statsd node.js server"
author "etsy - https://github.com/etsy/statsd"
# used to be: start on startup
# until we found some mounts weren't ready yet while booting:
start on started mountall
stop on shutdown
# Automatically Respawn:
respawn
respawn limit 99 5
script
# Not sure why $HOME is needed, but we found that it is:
export HOME="/root"
exec /usr/bin/node /opt/statsd/stats.js /opt/statsd/local.js >> /var/log/statsd.log 2>&1
end script
post-start script
# Optionally put a script here that will notifiy you node has (re)started
# /root/bin/hoptoad.sh "node.js has started!"
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment