Click to See Complete Forum and Search --> : Auto Ping
Arisen
02-01-2001, 06:38 PM
It seems that my Cable internet connection closes when if I am not active. It has been suggested that I create a cron job to ping (any external server) ecery so often to keep the connection alive.
I have a vague idea hox to create the cron, but i am not at all knowledgeable about creating scripts...
Help!
iDxMan
02-01-2001, 07:30 PM
Depending on what you need (eg: error checking the output of 'ping',etc..) you might not need to create a script..
cron entry:
0 * * * * ping -c 20 site_or_ip.to.ping
This will ping the site in question every hour, sending & receiving 20 ECHO_RESPONSE packets..
Crude, but it works.. You might want to look into some bash or perl if you want to do anything else such as selecting multiple sites to ping (eg: first one is down, move on),etc..
-r
Craig McPherson
02-01-2001, 09:39 PM
You could do every half-hour like this:
0,30 * * * * ping -c 5 site_or_ip.to.ping
Or every minute (kinda overkill, so we just send 1 packet) like this:
* * * * * ping -c 1 site_or_ip.to.ping
Actually, you probably want to redirect the output to /dev/null:
0 * * * * ping -c 2 site_or_ip.to.ping > /dev/null
Otherwise, the output will probably get redirected to your log files.