Source

vabs / var / vabs / yate / src / rc.yate

Full commit
#!/bin/bash
OPTS="-rs -vvv -l /var/log/yate"

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

RETVAL=0

# See how we were called.
case "$1" in
    start)
	echo "Starting YATE"
        unset DISPLAY

	yate -d -p /var/run/yate.pid $OPTS
        RETVAL=$?
	if [ $RETVAL -gt 0 ]; then
	    #stat_fail
	    echo "Failed starting YATE"
	else
	    #add_daemon yate
	    touch /var/lock/yate
	    #stat_done
	    echo "Starting YATE successfully"
	fi
	;;
    stop)
	echo "Stopping YATE"
	[ -f /var/run/yate.pid ] && kill $(cat /var/run/yate.pid) > /dev/null 2>&1
	RETVAL=$?
	if [ $RETVAL -gt 0 ]; then
	    #stat_fail
	    echo "Failed stopping YATE"
	else
	    rm -f /var/run/yate.pid
	    rm -f /var/lock/yate
	    #rm_daemon yate
	    #stat_done
	    echo "Stopping YATE successfully"
	fi
	;;
    status)
        [ -f /var/run/yate.pid ]  && echo -e "Yate is running" || echo -e "Yate is not running"
        ;;
        *)
	echo $"Usage: $0 {start|stop|status}"
	;;
esac
exit $RETVAL