openbsd-ports/net/pptp/files/pptp_reconnect
reinhard a526a2a18b pptp-linux is an implementation of the PPTP protocol for Linux and
other Unix systems.

port based on NetBSD package.

thanks karma@altern.org and Alexander.Farber@t-online.de for testing.
2000-12-21 14:02:52 +00:00

38 lines
927 B
Bash

#!/bin/sh
# $OpenBSD: pptp_reconnect,v 1.1.1.1 2000/12/21 14:02:52 reinhard Exp $
#
# PPTP reconnect script
#
# sample crontab entry: 0,30 * * * * /sbin/ping -c 2 MY_REMOTE_PEER_IP >/dev/null || /usr/local/sbin/pptp-reconnect
#
#
# INSTALL-INSTRUCTIONS: edit below ip and uncomment the line
#MODEMIP=10.0.0.138
PATH=/bin:/usr/bin:/sbin:/usr/sbin:PREFIX/sbin
if [ "$MODEMIP" = "" ]; then
echo "You have to edit the pptp-reconnect script."
exit
fi
echo "Killing pppd."
kill -9 `ps -ax|grep pppd|grep -v grep|awk '{print $1}'`
/bin/sleep 3
echo "Killing pptp."
kill -9 `ps -ax|grep pptp|grep -v pptp-reconnect|grep -v grep|awk '{print $1}'`
/bin/sleep 3
if [ -x /var/run/pptp/$MODEMIP ]; then
/bin/rm -f /var/run/pptp/$MODEMIP
fi
echo "Establishing connection."
PREFIX/sbin/pptp $MODEMIP >/var/log/ppp.log 2>&1
/bin/sleep 7
echo "Flushing rulesets:"
/sbin/ipf -Fa -f /etc/ipf.rules
/sbin/ipnat -CF -f /etc/ipnat.rules