Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
start on runlevel [2345]
setuid www-data
setgid www-data
chdir /opt/graphite
respawn
respawn limit 5 300
expect daemon
author "Andrew Johnstone"
description "Starts the carbon cache daemon"
usage "instance - name of instance"
version "0.1"
console output
debug
start on startup
stop on shutdown
env CONFIG="conf/carbon-cache.conf"
env INSTANCE=
#env PID="/opt/graphite/storage/carbon-cache-$INSTANCE.pid"
#pid timeout 10
instance $INSTANCE
pre-start script
set -e
echo "xxxx">/tmp/wtf
test -d /opt/graphite || { stop; exit 0; }
# if [ ! -n "$INSTANCE" ]; then
# awk '/\[cache:(.*)\]/ { gsub(/\[cache:/, ""); print }' /opt/graphite/conf/carbon-cache.conf | sed 's/]//g' | while read INSTANCE_PID; do
# PID_PATH="/opt/graphite/storage/carbon-cache-${INSTANCE_PID}.pid"
# if [ -e "${PID_PATH}"]; then
# logger -is -t "$UPSTART_JOB" "Removing pid `cat ${PID_PATH}` from ${PID_PATH}"
# echo "$UPSTART_JOB" "Removing pid `cat ${PID_PATH}` from ${PID_PATH}" > /tmp/test
# rm -v "${PID_PATH}"
# fi
# done
# else
# echo "NA";
# fi
end script
exec ./bin/carbon-cache.py --config="$CONFIG" --instance="$INSTANCE" start >> /tmp/upstart.log 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment