- own directories
[packages/collectd.git] / collectd.init
1 #!/bin/sh
2 #
3 # collectd      collectd (collectd daemon)
4 #
5 # chkconfig:    345 93 11
6 #
7 # description:  utility that colect various system information into rrd files
8 #
9 # $Id$
10
11 # Source function library
12 . /etc/rc.d/init.d/functions
13
14 # Get service config
15 [ -f /etc/sysconfig/collectd ] && . /etc/sysconfig/collectd
16
17 # Get network config
18 . /etc/sysconfig/network
19
20 # Check that networking is up.
21 if is_yes "${NETWORKING}"; then
22         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
23                 msg_network_down collectd
24                 exit 1
25         fi
26 else
27         exit 0
28 fi
29
30 start() {
31         # Check if the service is already running?
32         if [ ! -f /var/lock/subsys/collectd ]; then
33                 msg_starting collectd
34                 daemon /usr/sbin/collectd
35                 RETVAL=$?
36                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/collectd
37         else
38                 msg_already_running collectd
39         fi
40 }
41
42 stop() {
43         if [ -f /var/lock/subsys/collectd ]; then
44                 msg_stopping collectd
45                 killproc collectd
46                 rm -f /var/lock/subsys/collectd >/dev/null 2>&1
47         else
48                 msg_not_running collectd
49         fi
50 }
51
52 condrestart() {
53         if [ -f /var/lock/subsys/collectd ]; then
54                 stop
55                 start
56         else
57                 msg_not_running collectd
58                 RETVAL=$1
59         fi
60 }
61
62 RETVAL=0
63 case "$1" in
64   start)
65         start
66         ;;
67   stop)
68         stop
69         ;;
70   restart)
71         stop
72         start
73         ;;
74   try-restart)
75         condrestart 0
76         ;;
77   force-reload)
78         condrestart 7
79         ;;
80   status)
81         status collectd
82         exit $?
83         ;;
84   *)
85         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
86         exit 3
87 esac
88
89 exit $RETVAL
This page took 0.089404 seconds and 3 git commands to generate.