#!/bin/sh
# Startup script for l7vsd
#
# chkconfig: - 95 05
# description: Run cron jobs that were left out due to downtime

# 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
    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