[pptp-server] periodically check a pptp client connections
Vladimir Strezhnev
vlast at indivisuallearning.com
Fri Mar 22 11:36:08 CST 2002
I found this script a while ago in this list archives.
Sorry, can not supply the original author credentials.
Hope his posting is still in the archives and can be traced.
######
#!/bin/bash
ans1=`ps -ef | grep pptp | grep -v grep | grep -v query | wc -l | /bin/awk
'{print $1}'`
tim=`date | awk '{print $4}'`
dat=`date | awk '{print $1 " " $2 " " $3 }'`
if [ "$ans1" = "0" ]
then echo "pptp is down!"
echo "cleaning up pptp"
ifconfig ppp0 down
if [ -e /var/run/ppp0.pid ]
then kill HUP `cat /var/run/ppp0.pid`
fi
if [ -e /var/run/pptp/* ]
then rm /var/run/pptp/*
fi
echo "re-initiating link on $dat at $tim"
/usr/sbin/pptp-command start
fi
#####
Sometimes the script failed to make a total cleen-up, so we used slightly
modified one for about a year without problems. It was run by cron every min.
#####
#!/bin/bash
ans1=`route -n | grep ppp0 | grep -v grep | grep -v query | wc -l | /bin/awk
'{print $1}'`
tim=`date | awk '{print $4}'`
dat=`date | awk '{print $1 " " $2 " " $3 }'`
if [ "$ans1" != "3" ]
then echo "pptp is down!"
echo "cleaning up pptp"
ifconfig ppp0 down
if [ -e /var/run/ppp0.pid ]
then kill HUP `cat /var/run/ppp0.pid`
fi
if [ -e /var/run/pptp/* ]
then rm /var/run/pptp/*
fi
echo "re-initiating link on $dat at $tim"
/usr/sbin/pptp-command stop
sleep 5
/usr/sbin/pptp-command start
fi
#####
On Friday 22 March 2002 05:07, you wrote:
> Hello,
>
> as i need a linux pptp VPN client to connect to a poptop pptp vpn linux
> server in order to link a little remote office branch to the main office
> quarter because multiple client connections FROM THE SAME IP do not work, i
> would like to automatically, by crontab, check, for example, every 5/10
> minutes if the pptp link is up and, if down, automatically run the pptp
> client command.
>
> Is there a script to check the link status?
>
> Thank you to everybody!
>
> Bye,
>
> Francesco Collini (from Italy)
>
> _______________________________________________
> pptp-server maillist - pptp-server at lists.schulte.org
> http://lists.schulte.org/mailman/listinfo/pptp-server
> --- To unsubscribe, go to the url just above this line. --
--
VLADIMIR STREZHNEV
System Engineer
IndiVisual Learning, LLC
St. Paul, MN
More information about the pptp-server
mailing list