#!/bin/sh
# Copyright (c) 2000-2001 SuSE GmbH Nuernberg, Germany. All rights reserved.
#
# Author: Bernd Kaindl
#
# /etc/init.d/pptpd
#

### BEGIN INIT INFO
# Provides:       pptpd
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start:  3 5
# Default-Stop:
# Description:    start pptp daemon
# Short-Description: pptp daemon
### END INIT INFO

PPTPD_BIN=/usr/sbin/pptpd
test -x $PPTPD_BIN || exit 5

# Shell functions sourced from /etc/rc.status:
. /etc/rc.status

# First reset status of this service
rc_reset

case "$1" in
    start)
	echo -n "Starting MS VPN server pptpd"
	if modprobe ppp_mppe ; then
		startproc -sq $PPTPD_BIN
		rc_status -v
	else
		rc_failed 3
	fi
	;;
    stop)
	echo -n "Shutting down MS VPN server pptpd"
	killproc -TERM $PPTPD_BIN
	rc_status -v
	rmmod ppp_mppe > /dev/null 2>&1
	;;
    restart)
	$0 stop
	$0 start
	rc_status
	;;
    force-reload)
	$0 stop && $0 start
	rc_status
	;;
    reload)
	rc_failed 3
        rc_status -v
        ;;
    status)
	echo -n "Checking for MS VPN server pptpd: "
	checkproc $PPTPD_BIN
        rc_status -v
        ;;
    *)
	echo "Usage: $0 {start|stop|status|restart|force-reload|reload}"
	exit 1
	;;
esac
rc_exit
