-
-
Save mplscorwin/7361413 to your computer and use it in GitHub Desktop.
This file contains 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 | |
### BEGIN INIT INFO | |
# Provides: statsd | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the statsd node server | |
# Description: starts statsd using nodejs forever | |
### END INIT INFO | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
NODE_HOME="/opt/nodejs/bin" | |
PATH=$PATH:$NODE_HOME | |
NAME=statsd | |
DESC=statsd | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
/opt/nodejs/node_modules/forever/bin/forever \ | |
start \ | |
-al /var/log/node_stats_forever.log \ | |
-ao /var/log/node_stats_out.log \ | |
-ae /var/log/node_stats_err.log \ | |
/opt/statsd/stats.js /etc/statsd.conf | |
echo "$NAME." | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
/opt/nodejs/node_modules/forever/bin/forever \ | |
stop \ | |
/opt/statsd/stats.js | |
echo "$NAME." | |
;; | |
*) | |
echo "Usage: $NAME {start|stop}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment