LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 05-08-2003, 02:12 AM   #1
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES11 / FC20/ OES / CentOS
Posts: 601

Rep: Reputation: 32
adsl down reload by itselve ?


Hy!

I have a problem everytime my isp is down.

How can i make my pc redial the internetconnection so about 5 minutes after the internetconnection is down.

My problem is that i have to restart the adsl-connection manual by typing /etc/adsl start.

Any idea ?

cu
 
Old 05-08-2003, 02:22 AM   #2
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 3,513

Rep: Reputation: 63
Use a cron job to check if the connection is up if it is not then the script would start the connection.
 
Old 05-08-2003, 02:50 AM   #3
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES11 / FC20/ OES / CentOS
Posts: 601

Original Poster
Rep: Reputation: 32
so i will do something like:

ip=`ifconfig -a ppp0 | grep "inet addr" | cut -f2 -d ":" | cut -f1 -d "P"`

with this i will get the ip but how can i compare the ip to the default (down) ip ?

if ip = 1.1.1.1 then /etc/init.d/adsl restart ????

i don not know how i can compare the default ip to the real ip!

thanks
 
Old 05-08-2003, 03:27 AM   #4
shahriars
LQ Newbie
 
Registered: Apr 2003
Posts: 22

Rep: Reputation: 15
you can use the following script

#!/bin/sh
getIP=`/sbin/ifconfig eth0 | grep "inet addr" | cut -d ":" -f2 | cut -d " " -f1`
if [ "$getIP" == "1.2.3.4" ] ; then
/path/to/diallingScript.sh
fi

copy it in a file in /root, say, dialInterNet.sh, chmod +x, then run crontab -e, and put the following entry

*/2 * * * * /root/dialInterNet.sh

that should solve your problem.

all the best.
 
Old 05-08-2003, 04:25 AM   #5
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES11 / FC20/ OES / CentOS
Posts: 601

Original Poster
Rep: Reputation: 32
thank you, for your help!
i will trie that and write back!

nice day!
 
Old 05-08-2003, 04:44 AM   #6
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES11 / FC20/ OES / CentOS
Posts: 601

Original Poster
Rep: Reputation: 32
sorry,

unfortunately i can not check if the ip is xx.xx.xx.xx because the dev is down if the isp is offline!

ppp0: error fetching interface information: Device not found

idea?
 
Old 05-09-2003, 08:58 AM   #7
shahriars
LQ Newbie
 
Registered: Apr 2003
Posts: 22

Rep: Reputation: 15
sorry, made a mistake. you should be dialing if the line is down, right? so the script should be

#!/bin/sh
getIP=`/sbin/ifconfig ppp0 | grep "inet addr" | cut -d ":" -f2 | cut -d " " -f1`
if [ "$getIP" != "1.2.3.4" ] ; then
/path/to/diallingScript.sh
fi


even if you don't get an IP address, i.e., if the link is down, the value for getIP will be null -- or in other words, they will not match the IP designated by your ISP (replaced with 1.2.3.4) and will dial.

hope this helps
 
Old 05-09-2003, 09:43 AM   #8
mawdryn
LQ Newbie
 
Registered: Jun 2001
Posts: 25

Rep: Reputation: 15
Hi,

This script could prove very useful as I have a similar problem

Sorry to hijack the thread, but what if it's a dynamic ip address? Would it not then always try reconnecting until it matched the specified ip address? Would there be a way to get it to check whether ppp0 is present full stop?
 
Old 05-09-2003, 09:55 AM   #9
shahriars
LQ Newbie
 
Registered: Apr 2003
Posts: 22

Rep: Reputation: 15
if you are having dynamic IPs, then you don't need to set rules to check the IP, you simply check if you have ppp0 up or not (in fact, I should have thought about it when the thread first arose, but i was thinking eth0 . . . :-( )

what you do is,


#!/bin/sh
getDev=`/sbin/ifconfig | grep ppp0`
if [ "$getDev" == "" ] ; then
/path/to/diallingScript.sh
fi


thus, if there is a ppp0, then the getDev will yeild some result and no scritp will run, on the other hand, if there _is_ no ppp0, then the result will be null and the script will run -- despite any IP conditionaing :-)

hope this solves your problem.

all the best.
 
Old 05-09-2003, 10:51 AM   #10
mawdryn
LQ Newbie
 
Registered: Jun 2001
Posts: 25

Rep: Reputation: 15
thanks very much for your help there
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
still problem in reload grub manomohan Red Hat 1 09-27-2005 07:22 AM
how to reload linux? zacherfamily Linux - Newbie 1 09-06-2005 10:50 PM
reload rh9 bobby_hawk Linux - Software 1 05-28-2005 09:07 AM
xinetd reload failed allelopath Linux - Networking 6 04-14-2005 04:38 PM
PCMCIA reload MattLaw Linux - Laptop and Netbook 3 09-04-2003 05:44 AM


All times are GMT -5. The time now is 05:21 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration