LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-05-2008, 11:59 PM   #1
r.stiltskin
Member
 
Registered: Oct 2003
Location: USA
Distribution: Xubuntu, Arch
Posts: 231

Rep: Reputation: 31
script to test, re-establish network connection


I'd like to write a perl or shell script to run as a cron job on a machine at a remote location (an ssh server that I need to access from time to time) that can test to see if its network connection is working, and if not, try to re-establish it by restarting networking, rebooting or something else.

What can my script do to determine if it is connected to the router, and if the router is connected to the internet?

Also, is there any kind of inexpensive device that will enable the computer to reboot a dsl modem/router (i.e. just turn it off & on again)?
 
Old 12-06-2008, 12:25 AM   #2
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware
Posts: 1,134

Rep: Reputation: 277Reputation: 277Reputation: 277
I had a similar issue about 18 months ago:

Code:
http://www.linuxquestions.org/questions/linux-wireless-networking-41/need-a-script-to-poll-for-connection...-563562/?highlight=ping
Can't help you with the router reboot, tho'...


cheers,
 
Old 12-06-2008, 12:47 AM   #3
r.stiltskin
Member
 
Registered: Oct 2003
Location: USA
Distribution: Xubuntu, Arch
Posts: 231

Original Poster
Rep: Reputation: 31
Thanks, that's a good idea. I can ping the router to verify the inside connection, then ping an external site to check the internet connection.

Now I just have to shop around for something to switch the router's power off/on.
 
Old 12-07-2008, 07:50 AM   #4
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
mrclisdue,
Please don't put links in "Code:" blocks -- they can't be clicked. Also, you have "trashed" this thread w/ that "Code:" block so that many Konqueror users (& who knows who else) get a huge horizontal scroll, which makes this very difficult to read. As a result, some may not bother to read the OP; this will reduce the pool of helpers. I, for one, won't, until the horizontal scrolling is gone. Please, edit & fix this. Thanks.
 
  


Reply



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
Script to test network connection? Moonman Linux - Networking 7 09-23-2008 12:34 PM
Python test script yields 'Connection refused' BigNate37 Linux - Server 1 12-03-2007 09:45 PM
How to test Linux network connection? hnash53 Linux - Networking 14 05-16-2005 05:40 PM
Automated Network Connection Test assyrian47 Linux - Networking 1 06-16-2004 09:05 PM
Can't establish network connection with Mandrake 8.1 Theophylact Linux - Networking 0 04-25-2002 03:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:38 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration