[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: adsl keep alive script
- To: Tzafrir Cohen <tzafrir(at-nospam)technion.ac.il>, linux-il(at-nospam)linux.org.il
- Subject: Re: adsl keep alive script
- From: Ghiora Drori <drori(at-nospam)edrori.com>
- Date: Fri, 30 Nov 2001 00:09:35 +0200
- Delivered-To: linux.org.il-linux-il@linux.org.il
- References: <Pine.GSO.4.33_heb2.09.0111292245100.22730-100000@csd>
- Sender: linux-il-bounce(at-nospam)cs.huji.ac.il
- User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.6+) Gecko/20011117
Hi,
I probably could use SIGTERM but I like using an axe...
*As the saying goes:
..* Lizzie Borden *took**an**Axe*,. She gave her mother forty *wacks*,.
When
she saw what she had done,. She gave her father forty one!"
Ghiora
Tzafrir Cohen wrote:
>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
>>
>>
>>#***********************************************************
>>
>
=================================================================
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