#!/bin/sh # $OpenBSD: pptp_reconnect,v 1.4 2003/01/24 11:49:21 reinhard Exp $ # # PPTP reconnect script # # sample crontab entry: # 0,30 * * * * /sbin/ping -c 2 MY_REMOTE_PEER_IP >/dev/null || PREFIX/sbin/pptp-reconnect # # # INSTALL-INSTRUCTIONS: edit following 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 -axocomm,pid | awk '/pppd/ {print $2}'` /bin/sleep 3 echo -n "Killing pptp" kill -9 `ps -axocomm,pid | grep -v pptp-reconnect | awk '/pptp/ {print $2}'` /bin/sleep 3 if [ -S /var/run/pptp/$MODEMIP ]; then /bin/rm -f /var/run/pptp/$MODEMIP echo -n " (removing socket)" fi echo "." echo "Establishing connection." echo "=========================================================" >> /var/log/ppp.log echo "Establishing connection at `date`." >> /var/log/ppp.log PREFIX/sbin/pptp $MODEMIP >> /var/log/ppp.log 2>&1 /bin/sleep 7