LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 01-14-2004, 08:37 AM   #1
Apollo77
Member
 
Registered: Feb 2003
Location: Toronto
Distribution: RH8 / FC1 / Gentoo / Debian / FreeBSD / Centos / Ubuntu
Posts: 182

Rep: Reputation: 35
Keep Alive Ping Script


I recently switched my DSL ISP. The new ISP drops connections that are idle for 30 minutes. I have no problem with that, but I want to ensure my connection stays alive non-stop because I run a server. My router can deal with this -- it just logs back in as soon as the connection drops, but I'd rather not continually log back in as the solution. The ISP suggests I run a script to send one ping every 29 minutes. Cool.

This is probably dead simple, but I don't know how to do it. Can anyone suggest the script I need?

Thanks,
Apollo
 
Old 01-14-2004, 08:44 AM   #2
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
# filename is 29
ping -c 1 www.yahoo.com;sleep 29m
29
# end of file

or add something similar to cron
 
Old 01-14-2004, 12:15 PM   #3
Apollo77
Member
 
Registered: Feb 2003
Location: Toronto
Distribution: RH8 / FC1 / Gentoo / Debian / FreeBSD / Centos / Ubuntu
Posts: 182

Original Poster
Rep: Reputation: 35
This question doesn't belong in the networking forum, but it's related to my previous question, so here goes ...

I set up my single ping cron job to look like this:

*/29 * * * * path-to-my-ping-script

It works fine, but runs the job at 0, 29, and 58 minutes past each hour. Is it possible to run a cron job every 29 minutes (not at discrete minutes each hour)? ie. I want it to run like this 0,29,58,27,56,25,54,23,52, and so on.
 
Old 01-14-2004, 12:36 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
no
 
Old 01-14-2004, 12:46 PM   #5
Apollo77
Member
 
Registered: Feb 2003
Location: Toronto
Distribution: RH8 / FC1 / Gentoo / Debian / FreeBSD / Centos / Ubuntu
Posts: 182

Original Poster
Rep: Reputation: 35
Short and sweet. I like it.

Ok, I'll run it every 20 minutes instead of every 29. OR, go with whansard's original "sleep 29m" solution.

Thank you.
Problem solved.
 
Old 01-14-2004, 12:46 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
why are you so fussed about every 29 minutes? you just need to ensure network activitiy within a 30 minute period, so run the ping every 20 minutes.... */20 easy.
 
Old 01-14-2004, 12:54 PM   #7
Apollo77
Member
 
Registered: Feb 2003
Location: Toronto
Distribution: RH8 / FC1 / Gentoo / Debian / FreeBSD / Centos / Ubuntu
Posts: 182

Original Poster
Rep: Reputation: 35
Is there an echo in here? Yes, as I said in my last post, I will go with every 20 minutes.

Not "fussed" about anything. It's all about learning. And thank you for helping me learn.
 
Old 05-18-2006, 08:39 PM   #8
cruzades
LQ Newbie
 
Registered: May 2006
Posts: 2

Rep: Reputation: 0
sir, this maybe 50% off topic, i hope you won't bash me.

noobie here, and i want to this on my PCLinuxOS box.

i need to ping my router (192.168.1.1), if it is unreachable, i need to lock the screen tru screen saver, and it won't unlock until ping returns successful.

note: screensaver will comeout repeatedly until ping is successful.

btw, im running a kiosk in this box, and want to block the screen after each time expires.

control i made is tru LAN.

thanks in advance and more power!
 
Old 05-19-2006, 12:29 PM   #9
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
you should ask this as a new question.
maybe a bash script with while, and a sleep at the end.
 
  


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
How to create a ping-tracking script..? daleo Programming 5 11-17-2005 03:03 AM
Linux ping script MPowers Linux - Networking 6 07-02-2005 04:18 PM
ping script richiehawtin Programming 7 08-28-2004 02:39 AM
Ping Random IPs using a tcsh script.. zeppelin Programming 7 08-07-2003 11:07 AM
check if server is alive by ping saavik Linux - Networking 1 05-06-2002 09:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:02 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