-
-
Save cbliard/3496087 to your computer and use it in GitHub Desktop.
Modified statsd.init.sh file to work on Debian with LSB functions
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/sh | |
# | |
# StatsD | |
# | |
# chkconfig: 3 50 50 | |
# description: StatsD init.d | |
. /lib/lsb/init-functions | |
desc=statsd | |
STATSDDIR=/opt/statsd | |
statsd=stats.js | |
user=statsd | |
node=/usr/bin/node | |
CONFFILE=${STATSDDIR}/dConfig.js | |
pidfile=/var/run/statsd.pid | |
start() { | |
log_daemon_msg "Starting $desc" | |
# for info: no stdout/stderr with start-stop-daemon | |
# if we cant log, we need a bootstrap script, see http://stackoverflow.com/questions/8251933/how-can-i-log-the-stdout-of-a-process-started-by-start-stop-daemon | |
start-stop-daemon --start --oknodo --quiet --background --make-pidfile -p ${pidfile} -d ${STATSDDIR} --chuid ${user} --exec ${node} -- ${statsd} ${CONFFILE} | |
log_end_msg $? | |
} | |
stop() { | |
log_daemon_msg "Stopping $desc" | |
start-stop-daemon --stop --oknodo --quiet -p ${pidfile} --exec ${node} --retry TERM/10/KILL/5 | |
log_end_msg $? | |
} | |
# See how we were called. | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status_of_proc ${node} ${desc} -p ${pidfile} | |
;; | |
restart) | |
stop | |
start | |
;; | |
*) | |
echo $"Usage: $desc {start|stop|restart|status}" | |
exit 1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment