[pptp-server] linux pptp client: how to stop it?

Tom Eastep teastep at evergo.net
Thu Jul 27 10:09:07 CDT 2000


Thus spoke Dave Morse:

> I have the linux pptp client working.  Now how do I get it to shut down
> and free ppp0?  This is so that I can start it again, after a remote
> server reboot or something.
> 

Here's the script that I use:

!/bin/sh
#
#  /etc/rc.d/init.d/pptp
#
# chkconfig: 5 12 85
# description: PPTP Link Control
#

NAME=Coporate
ADDRESS=1.2.3.4
USER='DOMAIN\teastep'

case "$1" in
	start)
		echo "Starting PPTP Connection to ${NAME}..."
		pptp $ADDRESS user $USER noauth
		if [ -n "`ifconfig | grep ppp0`" ]; then
			touch /var/lock/subsys/pptp
                fi
		;;
	stop)
		echo "Stopping $NAME PPTP Connection..."
		if ( /usr/bin/killall pptp ); then
		    echo "Stopped pptp"
		else
		    rm -f /var/run/pptp/$ADDRESS
                fi

		if ( /usr/bin/killall pppd ); then
		    echo "Stopped pppd"
                fi
		rm -f /var/lock/subsys/pptp
		
		sleep 5
		;;
	restart)
		echo "Restarting $NAME PPTP Connection..."
		if ( killall pptp ); then
		    echo "stopped pptp"
                else
		    rm -f /var/run/pptp/$ADDRESS
                fi
		
		if ( killall pppd ); then
		    echo "stopped pppd"
                fi
		
		sleep 5

		pptp $ADDRESS  user $USER noauth
		;;
	status)
		ifconfig ppp0
		;;
	*)
		echo "Usage: $0 {start|stop|restart|status}"
		;;
esac

I place a seperate copy in /etc/rc.d/init.d for each PPTP server that I
connect to (pptpA, pptpB, ...).

I can then type:

	service pptpA start
	service pptpA stop

This is RedHat-centric but can be adapted to other setups.

-Tom
-- 
Tom Eastep             \  Eastep's First Principle of Computing:
ICQ #60745924           \  "Any sane computer will tell you how it
teastep at evergo.net       \   works if you ask it the proper questions"
Shoreline, Washington USA \___________________________________________




More information about the pptp-server mailing list