diff options
Diffstat (limited to 'system/collectd/rc.collectd')
-rw-r--r-- | system/collectd/rc.collectd | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/system/collectd/rc.collectd b/system/collectd/rc.collectd new file mode 100644 index 0000000000..2323395929 --- /dev/null +++ b/system/collectd/rc.collectd @@ -0,0 +1,74 @@ +#!/bin/sh +# +# rc.d script for collectd +# +# Thanks to miklos from slacky.eu + +exec=/usr/sbin/collectd +prog=$(basename $exec) +configfile=/etc/collectd.conf +pidfile=/var/run/collectd.pid + +start() { + [ -x $exec ] || exit 5 + if [ -f $pidfile ]; then + echo "Seems that an active process is up and running with pid $(cat $pidfile)" + echo "If this is not true try first to remove pidfile $pidfile" + exit 5 + fi + echo $"Starting $prog" + $exec -P $pidfile -C $configfile +} + +stop() { + if [ -e $pidfile ]; then + echo "Stopping $prog" + kill -QUIT $(cat $pidfile) 2>/dev/null + rm $pidfile + fi +} + +status() { + echo -n "$prog is " + CHECK=$(ps aux | grep $exec | grep -v grep) + STATUS=$? + if [ "$STATUS" == "1" ]; then + echo "not running" + else + echo "running" + fi + +} + +restart() { + stop + start +} + +reload() { + restart +} + +force_reload() { + restart +} + +case "$1" in + start) + $1 + ;; + stop) + $1 + ;; + restart) + $1 + ;; + status) + $1 + ;; + *) + echo $"Usage: $0 {start|stop|status|restart}" + exit 2 +esac +exit $? + |