#!/bin/sh # # Startup/shutdown script for SmokePing # # Linux chkconfig stuff: # # chkconfig: 2345 99 10 # description: Startup/shutdown script for SmokePing # ### BEGIN INIT INFO # Provides: smokeping # Required-Start: $syslog $local_fs # Required-Stop: $syslog $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: SmokePing # Description: SmokePing ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions DAEMON=smokeping exec=/opt/smokeping/bin/smokeping prog=smokeping config=/opt/smokeping/etc/config logfile=/var/log/smokeping.log lockfile=/var/lock/subsys/smokeping check() { # Check that we're a privileged user [ `id -u` = 0 ] || exit 4 # Check if smokeping is executable [ -x $exec ] || exit 5 } start () { check [ -f $config ] || exit 6 echo -n $"Starting $prog: " # start daemon daemon $exec --config=$config --logfile=$logfile RETVAL=$? echo [ $RETVAL = 0 ] && touch $lockfile return 0 } stop () { check # stop daemon echo -n $"Stopping $prog: " killproc $DAEMON RETVAL=$? echo [ $RETVAL = 0 ] && rm -f $lockfile return 0 } restart() { stop start } configtest() { check [ -f $config ] || exit 6 $exec --config=$config --check } case $1 in start) start ;; stop) stop ;; restart) restart ;; condrestart|try-restart) [ -f $lockfile ] && restart || : ;; reload) echo -n $"Reloading $prog: " killproc $DAEMON -HUP RETVAL=$? echo ;; force-reload) echo -n $"Reloading $prog: " if ! killproc $DAEMON -HUP; then restart fi echo ;; status) status -l $(basename $lockfile) $DAEMON RETVAL=$? ;; restartlog) stop cat /dev/null > $logfile start ;; configtest) configtest ;; *) echo $"Usage: $prog {start|stop|restart|restartlog|condrestart|try-restart|reload|force-reload|configtest|status}" exit 2 esac exit $RETVAL