#
# 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
else
msg_already_running collectd
fi
- ;;
- stop)
+}
+
+stop() {
if [ -f /var/lock/subsys/collectd ]; then
msg_stopping collectd
killproc collectd
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
-