1 |
On Mon, Feb 21, 2011 at 12:39:43AM -0500, Philip Webb wrote: |
2 |
> 110220 Philip Webb wrote: |
3 |
> > 110220 Florian Philipp wrote: |
4 |
> >> Just change your cron job to look like |
5 |
> >> 'test -e /var/run/dhcpcd.pid && fetchmail' |
6 |
> > That's by far the simplest & it still fetches the mail, |
7 |
> > so we'll see if it also avoids the occasional internal spam msgs. |
8 |
> |
9 |
> Indeed it does: I tried delaying starting the I/net connection |
10 |
> & there is no 'dead.letter' file. Thanks again. |
11 |
> |
12 |
> PS the file is /var/run/dhcpcd-eth0.pid , not as above. |
13 |
|
14 |
btw, if I need to check if the network is up in a script, I usually do |
15 |
|
16 |
ping -q -c1 -w4 some.remote.host >/dev/null 2>&1 && command-to-run-if-remote-host-reachable |
17 |
|
18 |
It the advantage that it checks directly connection to the host |
19 |
you wish to connect to, so it also won't run the command if your network |
20 |
is up, but the remote host is inaccessible... |
21 |
|
22 |
If your server doesn't respond to pings, just use some other server |
23 |
(eg google's public dns 8.8.8.8) |
24 |
|
25 |
The -w4 paramater controls how long to wait for reply if the network is |
26 |
up, but the reply is not comming (ie a network problem, if your network |
27 |
connect is down, ping will return immediately with a "network |
28 |
unreachable" or "unknown host" error) |
29 |
|
30 |
yoyo |