On Mon, Feb 21, 2011 at 12:39:43AM -0500, Philip Webb wrote:
> 110220 Philip Webb wrote:
> > 110220 Florian Philipp wrote:
> >> Just change your cron job to look like
> >> 'test -e /var/run/dhcpcd.pid && fetchmail'
> > That's by far the simplest & it still fetches the mail,
> > so we'll see if it also avoids the occasional internal spam msgs.
> 
> Indeed it does: I tried delaying starting the I/net connection
> & there is no 'dead.letter' file.  Thanks again.
> 
> PS the file is  /var/run/dhcpcd-eth0.pid , not as above.

btw, if I need to check if the network is up in a script, I usually do

ping -q -c1 -w4 some.remote.host >/dev/null 2>&1 && 
command-to-run-if-remote-host-reachable

It the advantage that it checks directly connection to the host
you wish to connect to, so it also won't run the command if your network
is up, but the remote host is inaccessible...

If your server doesn't respond to pings, just use some other server
(eg google's public dns 8.8.8.8)

The -w4 paramater controls  how long to wait for reply if the network is
up, but the reply is not comming (ie a network problem, if your network
connect is down, ping will return immediately with a "network
unreachable" or "unknown host" error)

yoyo

Reply via email to