#!/bin/sh
# 
# netdump-server	This starts, stops, and reloads the netdump
#                       server.
#
# chkconfig: - 80 20
# description: The netdump server
# pidfile: /var/run/netdump-server.pid
# config: /etc/netdump.conf
#

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

[ -f /usr/sbin/netdump-server ] || exit 1

RETVAL=0

start(){
	# Start daemons.
	echo -n "Starting netdump server: "
	daemon --user netdump /usr/sbin/netdump-server --daemon
	RETVAL=$?
	echo
	touch /var/lock/subsys/netdump-server
}

stop(){
	# Stop daemons.
	echo -n "Stopping netdump server: "
	killproc /usr/sbin/netdump-server
	RETVAL=$?
	echo
	rm /var/lock/subsys/netdump-server
}

restart(){
	stop
	start
}

reload(){
	#Uhm. What to do here.
	touch /var/lock/subsys/netdump-server
}

condrestart(){
    [ -e /var/lock/subsys/netdump-server ] && restart
}

# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status /usr/sbin/netdump-server
        ;;
    restart|reload)
        restart
        ;;
#    reload)
#        reload
#        ;;
    condrestart)
        condrestart
        ;;
    *)
        echo "Usage: netdump-server {start|stop|status|restart|condrestart}"
        RETVAL=1
esac

exit $RETVAL