#!/bin/sh
# Start/Stop script for l7vsd
#
# chkconfig: 2345 95 34
# description: Start and stop l7vsd
#              
# processname: l7vsd
#
# Author: NTT COMWARE
# Released: August 2005
# Licence: GNU General Public Licence

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

[ -f /usr/sbin/l7vsd ] || exit 0

if [ /var/run/l7vs/l7vs ]; then
	rm -rf /var/run/l7vs/l7vs
fi
prog="l7vsd"

start() {
	 echo -n $"Starting $prog: " 
#    daemon +19 l7vsd
    daemon +19 /usr/sbin/l7vsd
    RETVAL=$?
    echo
    return $RETVAL
}

stop() {
    if test "x`pidof l7vsd`" != x; then
	echo -n $"Stopping $prog: "
	killproc l7vsd
	echo
    fi
    RETVAL=$?
    return $RETVAL
}

case "$1" in
	start)
	    start
	    ;;
	
	stop)
	    stop
	    ;;
	
	status)
	    status l7vsd
	    ;;
	restart)
	    stop
	    start
	    ;;
	condrestart)
	    if test "x`pidof l7vsd`" != x; then
		stop
		start
	    fi
	    ;;
	
	*)
	    echo $"Usage: $0 {start|stop|restart|condrestart|status}"
	    exit 1

esac

exit $RETVAL
