summaryrefslogtreecommitdiff
path: root/network/graphite-carbon/rc.carbon-cache
diff options
context:
space:
mode:
authorMario Preksavec <mario at slackware dot hr>2015-02-06 20:32:58 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2015-02-06 20:32:58 +0700
commit8e345cefbe19d133e041bd99e469ce3d044ea7dc (patch)
treefeed123081bd13abb57d1382854a911c054dc890 /network/graphite-carbon/rc.carbon-cache
parent171e85069717f372bfd9ba8ad6215f31bcc19bf2 (diff)
downloadslackbuilds-8e345cefbe19d133e041bd99e469ce3d044ea7dc.tar.gz
network/graphite-carbon: Added (Backend data caching).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
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