[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: adsl keep alive script



On Thu, 29 Nov 2001, Ghiora Drori wrote:

> Hi,
> Here is my script seems to work for month...
> Change the YOUR_ISV to the name of your ISV'S DNS or mail server
> and yourname@IYOUR_ISV to
>
> And Yes there is an "l" between the @ and YOUR_ISV when invoking pptp
>
> Also do not forget to make sure thecleaning person is not hooking up the
> vacum instead of your moedm once in a while. :)
> Ghiora
>
>
> #*******************************************************************************************
> #!/bin/bash
>
> while [ 1 ]
> do
>   # This returns 1 if not connected !!
>   ping -c 3 YOURISV.co.il  >>/dev/null 2>&1
>   if [ $? != 0 ]
>   then
>       date >>/tmp/dial_log 2>&1
>       echo "Attempting to connect " >>/tmp/dial_log
>       #eliminate the pptp process
>       ELIM=`ps -eaf |grep pptp |grep -v grep |tail -n1 |awk '{ print
> $2 }'`
>       kill -9 $ELIM
>       #lower and raise th0 to clear the connections to the modem
>       /sbin/ifconfig eth0 down
>       /sbin/ifconfig eth0 up
>       #remove a bsocket left by pptp (a bug)
>     rm -f /var/run/pptp/10.0.0.138

Why did use "kill -9" in the first place if it leaves you so much
cleaning-up?

Why not simply "kill"?

>       # run pptp
>       /usr/sbin/pptp 10.0.0.138  user yourname@IYOURUSV remotename
> "10.0.0.138 RELAY_PPP1"defaultroute netmask 255.0.0.0 mtu 1500 mru
> 1500 noauth >/dev/null 2>&1 &
>       /etc/firewall
>     if [ -f /var/run/named.pid ]
>               then
>            ps -eaf |grep -v grep |grep `cat /var/run/named.pid`
>  >/dev/null 2>&1
>            if [ $? != 0 ]
>            then
>           /usr/local/sbin/named  &
>            fi
>       else
>           /usr/local/sbin/named  &
>       fi
>   else
>       date >>/tmp/dial_log 2>&1
>       echo "Connected " >>/tmp/dial_log
>   fi
>
>   sleep 500  # Every 15 minutes we check we are connected
> done
> exit 0
>
>
> #***********************************************************

-- 
Tzafrir Cohen
mailto:tzafrir@technion.ac.il
http://www.technion.ac.il/~tzafrir


=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il