[pptp-server] Pptp client linux automatic

root leuzim at pib.com.br
Tue Nov 14 06:38:04 CST 2000


Hey.. I make a little script to start and stop vpn client more easy.

pptp-up in /sbin/init.d

#!/bin/bash
/dir/vpn/pptp (ip server machine) 
/bin/sleep 3 #wait for ip adress to comeup 

pptp-down in /sbin/init.d

#!/bin/bash

killall -9 pppd # Killall pppds actives
killall -9 pptp #Killall pptps actives
rm -f /var/run/pptp/* #Remove any old dead PPTP session
rm -f /var/run/ppp* # Remove any old dead ppp session
ifconfig ppp0 down #Shutdown interface ppp

I using a Suse 6.4 and I make a rc file to bring up pptp client on boot system
and view the status. You can reload the pptp more easy with rcpptp start and
rcpptp stop.

I make a script and put it on /sbin/init.d and link in /usr/sbin to use rcpptp

#! /bin/sh
#file  /sbin/init.d/pptp

.. /etc/rc.config

# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}

# Force execution if not called by a runlevel directory.
test $link = $base && START_PPTP=yes
test "$START_PPTP" = "yes" || exit 0


# The echo return value for success (defined in /etc/rc.config).
return=$rc_done
case "$1" in
    start)
        echo -n "Starting PPTP services:"
        startproc /sbin/init.d/pptp-up || return=$rc_done
        /bin/sleep 2
	echo -e "$return"
        ;;
    stop)
        echo -n "Shutting down PPTP services:"
        startproc /sbin/init.d/pptp-down || return=$rc_done 
        echo -e "$return"
        ;;
   restart|reload)
        $0 stop  &&  $0 start  || return=$rc_failed
        ;;
    status)
        echo -n "Checking for service pptp: "
        checkproc /dirvpnclient/pptp && echo -n "Vpn Up" || echo -n "Vpn Down"
	echo -e "$return"	
	;;
   *)
        echo "Usage: $0 {start|stop|restart|reload|status}"
        exit 1 
esac

# Inform the caller not only verbosely and set an exit status.
test "$return" = "$rc_done" || exit 1
exit 0


[]s 
Wildcat



More information about the pptp-server mailing list