#!/bin/sh # # chkconfig: 235 97 03 # description: smokeping utilities for \ # system monitoring. # # smokeping Monitor Network latency # # chkconfig: 12345 01 99 # description: Monitor network latency # # processname: smokeping # pidfile: /var/run/smokeping/smokeping.pid # # /etc/init.d/smokeping # # source function library . /etc/rc.d/init.d/functions RETVAL=0 prog="/opt/smokeping/bin/smokeping" pid="/var/run/smokeping/smokeping.pid" args="--logfile=/var/log/smokeping.log $SMOKEPING_ARGS" # See how we were called. case "$1" in start) echo -n $"Starting smokeping: " piddir=$(dirname "$pid") if test ! -d "$piddir" ; then mkdir -p "$piddir" && chown smokeping "$piddir" || failure fi daemon --user smokeping --pidfile "$pid" $prog $args; #daemon --user smokeping $prog $args; RETVAL=$? ;; stop) echo -n $"Stopping smokeping: " if [ -n "`pidfileofproc $prog`" ] ; then killproc -p $pid elif [ -n "`pidofproc -p "$pid" $prog`" ]; then killproc -p "$pid" $prog else failure $"Stopping smokeping" fi RETVAL=$? ;; status) status $prog RETVAL=$? ;; check|restart|reload) $prog --$1 RETVAL=$? ;; *) echo "Usage: smokeping {start|stop|status|restart|reload|check}" exit 1 esac exit $RETVAL