1 #!/bin/bash
3 ### BEGIN INIT INFO
4 # Provides: collectd
5 # Required-Start: $local_fs $remote_fs $network
6 # X-UnitedLinux-Should-Start: $named $time apache mysql
7 # Required-Stop: $local_fs $remote_fs $network
8 # X-UnitedLinux-Should-Stop:
9 # Default-Start: 3 5
10 # Default-Stop: 0 1 2 6
11 # Short-Description: Statistics daemon collectd
12 # Description: Start the statistics daemon collectd
13 ### END INIT INFO
16 #
17 # load the configuration
18 #
19 test -s /etc/rc.status && . /etc/rc.status && rc_reset
21 RETVAL=0
22 ARGS=""
23 prog="collectd"
24 CONFIG=/etc/collectd.conf
26 if [ -r /etc/default/$prog ]; then
27 . /etc/default/$prog
28 fi
30 start () {
31 echo -n $"Starting $prog: "
32 RETVAL=1
33 if [ -r "$CONFIG" ]
34 then
35 eval startproc /usr/sbin/collectd -C "$CONFIG"
36 RETVAL=$?
37 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
38 fi
39 rc_failed $RETVAL
40 rc_status -v
41 }
42 stop () {
43 echo -n $"Stopping $prog: "
44 killproc $prog
45 RETVAL=$?
46 rc_failed $RETVAL
47 rc_status -v
48 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
49 }
50 # See how we were called.
51 case "$1" in
52 start)
53 start
54 ;;
55 stop)
56 stop
57 ;;
58 status)
59 status $prog
60 ;;
61 restart|reload)
62 stop
63 sleep 1
64 start
65 ;;
66 condrestart)
67 [ -f /var/lock/subsys/$prog ] && restart || :
68 ;;
69 *)
70 echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
71 exit 1
72 esac
74 rc_exit
75 # vim:syntax=sh