#! /bin/sh # # chkconfig: - 60 20 # description: check is some hosts are alive # processname: icmpmonitor # Get config. . /etc/sysconfig/network # Get functions . /etc/rc.d/init.d/functions # Check that networking is up. if [ ${NETWORKING} = "no" ] ; then exit 0 fi [ -f /usr/local/sbin/icmpmonitor ] || exit 0 [ -f /usr/local/etc/icmpmonitor.cfg ] || exit 0 RETVAL=0 # See how we were called. case "$1" in start) echo -n "Starting icmpmonitor: " daemon /usr/local/sbin/icmpmonitor -d -f /usr/local/etc/icmpmonitor.cfg RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/icmpmonitor ;; stop) echo -n "Stopping icmpmonitor: " killproc icmpmonitor RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/icmpmonitor ;; status) status icmpmonitor RETVAL=$? ;; restart) $0 stop $0 start RETVAL=$? ;; *) echo "Usage: $0 {start|stop|status|restart}" exit 1 ;; esac exit $RETVAL