-
-
Save davidgiesberg/3763658 to your computer and use it in GitHub Desktop.
Modified statsd.init.sh file to work on Debian
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Carbon (part of Graphite) | |
# | |
# chkconfig: 3 50 50 | |
# description: Carbon init.d | |
. /etc/rc.d/init.d/functions | |
prog=carbon | |
RETVAL=0 | |
start() { | |
echo -n $"Starting $prog: " | |
PYTHONPATH=/usr/local/lib/python2.6/dist-packages/ /opt/graphite/bin/carbon-cache.py start | |
RETVAL=$? | |
if [ $RETVAL = 0 ]; then | |
success "carbon started" | |
else | |
failure "carbon failed to start" | |
fi | |
echo | |
return $RETVAL | |
} | |
stop() { | |
echo -n $"Stopping $prog: " | |
PYTHONPATH=/usr/local/lib/python2.6/dist-packages/ /opt/graphite/bin/carbon-cache.py stop | |
RETVAL=$? | |
if [ $RETVAL = 0 ]; then | |
success "carbon stopped" | |
else | |
failure "carbon failed to stop" | |
fi | |
echo | |
return $RETVAL | |
} | |
# See how we were called. | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
PYTHONPATH=/usr/local/lib/python2.6/dist-packages/ /opt/graphite/bin/carbon-cache.py status | |
RETVAL=$? | |
;; | |
restart) | |
stop | |
start | |
;; | |
*) | |
echo $"Usage: $prog {start|stop|restart|status}" | |
exit 1 | |
esac | |
exit $RETVAL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# StatsD | |
# | |
# chkconfig: 3 50 50 | |
# description: StatsD init.d | |
. /etc/rc.d/init.d/functions | |
prog=statsd | |
STATSDDIR=/opt/statsd | |
statsd=./stats.js | |
LOG=/var/log/statsd.log | |
ERRLOG=/var/log/statsderr.log | |
CONFFILE=${STATSDDIR}/local.js | |
pidfile=/var/run/statsd.pid | |
lockfile=/var/lock/subsys/statsd | |
RETVAL=0 | |
STOP_TIMEOUT=${STOP_TIMEOUT-10} | |
start() { | |
echo -n $"Starting $prog: " | |
cd ${STATSDDIR} | |
# See if it's already running. Look *only* at the pid file. | |
if [ -f ${pidfile} ]; then | |
failure "PID file exists for statsd" | |
RETVAL=1 | |
else | |
# Run as process | |
${statsd} ${CONFFILE} >> ${LOG} 2>> ${ERRLOG} & | |
RETVAL=$? | |
# Store PID | |
echo $! > ${pidfile} | |
# Success | |
[ $RETVAL = 0 ] && success "statsd started" | |
fi | |
echo | |
return $RETVAL | |
} | |
stop() { | |
echo -n $"Stopping $prog: " | |
killproc -p ${pidfile} | |
RETVAL=$? | |
echo | |
[ $RETVAL = 0 ] && rm -f ${pidfile} | |
} | |
# See how we were called. | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status -p ${pidfile} ${prog} | |
RETVAL=$? | |
;; | |
restart) | |
stop | |
start | |
;; | |
condrestart) | |
if [ -f ${pidfile} ] ; then | |
stop | |
start | |
fi | |
;; | |
*) | |
echo $"Usage: $prog {start|stop|restart|condrestart|status}" | |
exit 1 | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment