3 # collectd Startup script for the Collectd statistics gathering daemon
5 # description: Collectd is a statistics gathering daemon used to collect \
6 # system information ie. cpu, memory, disk, network
7 # processname: collectd
8 # config: /etc/collectd.conf
9 # config: /etc/sysconfig/collectd
10 # pidfile: /var/run/collectd.pid
12 # Source function library.
13 . /etc/init.d/functions
19 CONFIG=/etc/collectd.conf
20 COLLECTD=/usr/sbin/collectd
21 COLLECTDMONPIDDIR="/var/run"
22 COLLECTDMONPID="$COLLECTDMONPIDDIR/collectdmon.pid"
26 if [ -r /etc/sysconfig/$service ]; then
27 . /etc/sysconfig/$service
30 if [[ ! -d $COLLECTDMONPIDDIR ]]; then
31 mkdir -p $COLLECTDMONPIDDIR
32 [ -n "${RUNAS}" ] && chown "${RUNAS}:" "$COLLECTDMONPIDDIR"
36 if test ! -r "$CONFIG"; then
39 if ! $COLLECTD -t -C "$CONFIG"; then
46 echo -n $"Starting collectd: "
49 if test "$rc" -ne 0; then
51 echo $"not starting due to configuration error"
52 failure $"not starting $service due to configuration error"
54 daemon --user "${RUNAS:-root}" $prog -P $COLLECTDMONPID -c $COLLECTD -- -C "$CONFIG" $ARGS
57 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$service
62 echo -n $"Stopping collectd: "
63 killproc -p $COLLECTDMONPID -d $MAXWAIT $prog
66 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$service
72 if test "$rc" -ne 0; then
74 echo $"not restarting due to configuration error"
75 failure $"not restarting $service due to configuration error"
82 # See how we were called.
91 status -p $COLLECTDMONPID $prog
97 [ -f /var/lock/subsys/$service ] && restart || :
100 echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"