summaryrefslogtreecommitdiff
path: root/network/graphite-carbon/rc.carbon-cache
diff options
context:
space:
mode:
Diffstat (limited to 'network/graphite-carbon/rc.carbon-cache')
-rw-r--r--network/graphite-carbon/rc.carbon-cache57
1 files changed, 57 insertions, 0 deletions
diff --git a/network/graphite-carbon/rc.carbon-cache b/network/graphite-carbon/rc.carbon-cache
new file mode 100644
index 0000000000..ee7c98630e
--- /dev/null
+++ b/network/graphite-carbon/rc.carbon-cache
@@ -0,0 +1,57 @@
+#!/bin/sh
+#
+# Start/stop/restart the carbon-cache daemon
+# Written by Mario Preksavec <mario@slackware.hr>
+
+BIN_FILE=/usr/bin/carbon-cache
+PID_FILE=/var/run/carbon-cache.pid
+CONF_FILE=/etc/carbon/carbon.conf
+
+rc_start() {
+ if [ -x $BIN_FILE ] && [ -f $CONF_FILE ]; then
+ if [ -f $PID_FILE ] && kill -0 $(cat $PID_FILE) 2>/dev/null; then
+ echo "carbon-cache daemon already running"
+ else
+ echo "Starting carbon-cache daemon: $BIN"
+ $BIN_FILE --config=$CONF_FILE --pidfile=$PID_FILE start
+ fi
+ fi
+}
+
+rc_stop() {
+ if [ -f $PID_FILE ] && kill -0 $(cat $PID_FILE) 2>/dev/null; then
+ echo "Stopping carbon-cache daemon: $BIN"
+ $BIN_FILE --config=$CONF_FILE --pidfile=$PID_FILE stop \
+ && rm -f $PID_FILE
+ fi
+}
+
+rc_status() {
+ if [ -f $PID_FILE ] && kill -0 $(cat $PID_FILE) 2>/dev/null; then
+ $BIN_FILE --config=$CONF_FILE --pidfile=$PID_FILE status
+ fi
+}
+
+rc_restart() {
+ rc_stop
+ sleep 1
+ rc_start
+}
+
+case "$1" in
+ 'start')
+ rc_start
+ ;;
+ 'stop')
+ rc_stop
+ ;;
+ 'restart')
+ rc_restart
+ ;;
+ 'status')
+ rc_status
+ ;;
+ *)
+ echo "usage $0 start|stop|restart|status"
+ ;;
+esac