1 #!/bin/bash
2 #
3 # collectd Startup script for the Collectd statistics gathering daemon
4 # chkconfig: - 99 01
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
15 RETVAL=0
16 ARGS=""
17 prog="collectdmon"
18 service="collectd"
19 CONFIG=/etc/collectd.conf
20 COLLECTD=/usr/sbin/collectd
21 COLLECTDMONPID=/var/run/collectdmon.pid
23 if [ -r /etc/default/$prog ]; then
24 . /etc/default/$prog
25 fi
27 start () {
28 echo -n $"Starting collectd: "
29 if [ -r "$CONFIG" ]
30 then
31 daemon $prog -P $COLLECTDMONPID -c $COLLECTD -- -C "$CONFIG"
32 RETVAL=$?
33 echo
34 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$service
35 fi
36 }
37 stop () {
38 echo -n $"Stopping collectd: "
39 killproc $prog
40 RETVAL=$?
41 echo
42 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$service
43 }
44 # See how we were called.
45 case "$1" in
46 start)
47 start
48 ;;
49 stop)
50 stop
51 ;;
52 status)
53 status $prog
54 ;;
55 restart|reload)
56 stop
57 start
58 ;;
59 condrestart)
60 [ -f /var/lock/subsys/$prog ] && restart || :
61 ;;
62 *)
63 echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
64 exit 1
65 esac
67 exit $?
69 # vim:syntax=sh