slackbuilds_ponce/system/collectd/rc.collectd
Matteo Bernardini 1b393452df system/collectd: Updated for version 5.4.0.
Added an rc script, fix for gcc-4.8.x,
disabled static stuff

Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
2013-11-08 17:35:12 +01:00

74 lines
1.1 KiB
Bash

#!/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 $?