#! /bin/sh


case "$1" in

    start)
    	/sbin/getcfg pptp_enable
	if [ "$?" != "1" ]; then
		echo "pptp daemon disable"
		exit 0
	fi
    	echo "update pptpd configuration"
	getcfg getpptpconf
	echo "pptpd server on"
	/sbin/pptpd
	;;

    stop)
	echo "pptpd down"
	killall -9 pptpd
	if [ "$?" = "0" ]; then echo "Done"
	else                    echo "FAILED"; fi
	;;

    restart)
    	$0 stop
	sleep 1
	$0 start
	;;

    *)
	echo "Usage: $0 (start|stop|restart)"
	exit 1
	;;

esac

exit 0

