]> git.pld-linux.org Git - packages/collectd.git/blobdiff - collectd.init
- deps for %service
[packages/collectd.git] / collectd.init
index d2c89a9cbc21279daf81b6eb65cc03828b84a2d0..bce6a5f79bf830b349b9188bb19abe9adc316659 100644 (file)
@@ -4,10 +4,9 @@
 #
 # chkconfig:   345 93 11
 #
-# description: utility that colect various system information  \
-#              into rrd files \
-
-
+# description: utility that colect various system information into rrd files
+#
+# $Id$
 
 # Source function library
 . /etc/rc.d/init.d/functions
 # Get service config
 [ -f /etc/sysconfig/collectd ] && . /etc/sysconfig/collectd
 
+# Get network config
+. /etc/sysconfig/network
 
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down collectd
+               exit 1
+       fi
+else
+       exit 0
+fi
 
-RETVAL=0
-
-case "$1" in
-  start)
+start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/collectd ]; then
                msg_starting collectd
@@ -30,8 +37,9 @@ case "$1" in
        else
                msg_already_running collectd
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/collectd ]; then
                msg_stopping collectd
                killproc collectd
@@ -39,20 +47,43 @@ case "$1" in
        else
                msg_not_running collectd
        fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/collectd ]; then
+               stop
+               start
+       else
+               msg_not_running collectd
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
   restart)
-       $0 stop
-       $0 start
-       exit $?
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status collectd
        exit $?
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
        exit 3
 esac
 
 exit $RETVAL
-
This page took 0.065091 seconds and 4 git commands to generate.