[Linux-disciples] Tweaking cron for network status
Stephen R Laniel
steve at laniels.org
Fri May 27 15:55:16 EDT 2005
I have a couple cron jobs that are sensitive to whether I'm
online. Fetchmail runs every minute or two, and when it's
not online it spits out constant error messages. So I'd
prefer it not to run when I'm not online. And every three
hours I rsync ~/Mail with a remote server. Not only do I
want that rsync job not to run when I'm offline, but I'd
like it not to run when my bandwidth is very low -- like
right now, when I'm in a coffeeshop and I don't want to
inconvenience everyone around me.
So I guess I ought to tweak the cron jobs to take note of
local network conditions. Ideally the tweaks would be
minimal: rather than
foo();
as they do now, they'd do
if( networkStatus() == {state1|state2|...} ) {
foo();
}
So. Any idea where I might find a good set of libraries to
do tests like this? Testing whether I'm on the Internet's
probably fairly easy (ping a pingable host), but how do I
test my bandwidth?
--
Stephen R. Laniel
steve at laniels.org
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
More information about the Linux-disciples
mailing list