This is a discussion on Shell script to reconnect when PPP / DSL interface goes down within the Shell scripting forums, part of the Development/Scripting category; Hello,, I need script which prompt me when net is dc on my server. regards...
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
| Sponsored Links | ||
|
|
|
||||
|
Hi,
This is part of script i use: Code:
#!/bin/bash
#set -x
dnsbroken=`ping -c1nqW5 -s8 www.yahoo.ca 2>&1 | grep -e "unknown" -e "denied" -e "permited"`
if [ -n "$dnsbroken" ]
then
# reconnect the connection
poff -a
pon dsl-provider
sleep 3
fi
# get current ip on ppp0
x=`/sbin/ifconfig ppp0`
y=${x#*inet addr:}
y=${y%% *}
# log current ip
echo $y > /home/ali/scripts/adsl_ip
exit 0
You can run this every 3 - 5 minutes via cron (as root). You can report the date, time and new ip address of machine as you like. change the hostname (Yahoo! Canada), log path (/home/ali/scripts/adsl_ip) and your connection name (dsl-provider), then run. |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Run mv command from ftp shell script | subin | Shell scripting | 6 | 05-02-2008 10:44 AM |
| shell script for ftp the file | vishal_titre | Shell scripting | 3 | 12-10-2007 09:40 AM |
| writing a shell script to find out my shell name | jaymob123 | Shell scripting | 1 | 10-08-2007 01:36 AM |
| require shell script | puppen | Shell scripting | 4 | 04-12-2006 10:42 PM |
| Shell Script dought | Mahesh | Shell scripting | 3 | 02-16-2005 01:13 PM |