#!/bin/bash
#
# voipong	This shell script takes care of starting and stopping voipong.
#
# chkconfig: 2345 65 35
# description: VoIPong Voice Over IP Sniffer
# processname: voipong
# pidfile: /var/run/voipong/voipong.pid
# config: /etc/voipong/voipong.conf

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

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

[ -f /etc/voipong/voipong.conf ] || exit 0

[ -x /usr/sbin/voipong ] || exit 0

# Source configuration file
[ -f /etc/sysconfig/voipong ] && . /etc/sysconfig/voipong

RETVAL=0
# See how we were called.
case "$1" in
start)
	echo -n "Starting voipong: "
	daemon voipong ${OPTIONS:-"-c /etc/voipong/voipong.conf"} >/dev/null 2>&1 && success || failure
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/voipong
	;;
stop)
	echo -n "Stopping voipong: "
	killproc voipong
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/voipong
	;;
status)
	status voipong
	RETVAL=$?
	;;
restart|reload)
	$0 stop
	$0 start
	RETVAL=$?
	;;
condrestart)
	[ -f /var/lock/subsys/voipong ] && restart
	;;
  *)
	echo "Usage: $0 {start|stop|status|restart|condrestart|reload}"
	exit 1
esac

exit $RETVAL
