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