[Plug] A somewhat simple question.

Adrian Chadd adrian at creative.net.au
Thu Jan 25 08:33:57 WST 2007


On Thu, Jan 25, 2007, Lee Jamieson wrote:
> Hi all,
> 
> 1.  I want to have ping running on my webserver box (debian netist
> running testing), all the time and to start at boot, if we get a power
> outage.  I only want it to ping every 200 seconds or so, just to keep
> my connection alive. Would someone mind walking me through the steps?
> 
> I'm off to work so I won't be able to reply until lunch though.
> 
> Thanks in advance!

* cron, a bit of software on all Unix systems I've ever touched, allows you
  to periodically schedule scripts to execute.
* So, write a simple shell script that'll do your ping:

#!/bin/sh

ping -c 5 -q <ip to ping goes here> >/dev/null 2>&1

* Then, use 'crontab -e' to edit your crontab and put this line ni:

*/4 * * * * /path/to/above/script.sh

Save the file and it'll be installed in your crontab. 'crontab -l' views it.

Then, check your cron logs for the result of your script - eg

tail -f /var/log/cron.log

(This bit is definitely platform specific unfortuantely. Yay to conformity and
consistency.)

It should log a line every 4 minutes as your script runs.

HTH,

Adrian

(man crontab, man -k crontab, man cron - all good things to read.)



More information about the plug mailing list