Blob Blame History Raw
#! /bin/bash
#
# smokeping    This starts and stops the smokeping daemon
# chkconfig: - 98 11
# description: Start and top the smokeping daemon
# processname: smokeping
#
### BEGIN INIT INFO
# Provides: smokeping
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Start and stop the smokeping daemon
# Description:  Daemon for smokeping - Latency Logging and Graphing System
### END INIT INFO
#

# Source function library.
. /etc/rc.d/init.d/functions

SMOKEPING=/usr/sbin/smokeping
LOCKF=/var/lock/subsys/smokeping
CONFIG=/etc/smokeping/config
PID=/var/run/smokeping/smokeping.pid

RETVAL=0

case "$1" in
  start)
	[ -x $SMOKEPING ] || exit 5
	[ -f $CONFIG ] || exit 6
	echo -n $"Starting smokeping: "
	daemon $SMOKEPING
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch $LOCKF
	;;
  stop)
	echo -n $"Stopping smokeping: "
	killproc $SMOKEPING
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f $LOCKF $PID
	;;
  status)
	status smokeping
	RETVAL=$?
        ;;
  reload)
	echo -n $"Reloading smokeping: "
	killproc $SMOKEPING -HUP
	RETVAL=$?
	echo
	;;
  restart|force-reload)
	$0 stop
	sleep 3
	$0 start
	RETVAL=$?
	;;
  condrestart|try-restart)
	if [ -f $LOCKF ] ; then
		$0 stop
		sleep 3
		$0 start
		RETVAL=$?
	fi
	;;
  *)
	echo $"Usage: $0 {start|stop|status|restart|force-reload|reload|condrestart|try-restart}"
	exit 1
esac

exit $RETVAL