Re: [gentoo-user] irritating cron habit : solved

2011-02-21 Thread YoYo Siska
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 21  
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



Re: [gentoo-user] irritating cron habit : solved

2011-02-21 Thread Adam Carter

 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 21 
 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)



Or you could use hping, which has the advantage that it tests the actual
service you want to use, rather than just the host it sits on;

sphinx adam # hping2 -c 1 -S -p 80 www.google.com /dev/null 21  echo
it worked
it worked


Re: [gentoo-user] irritating cron habit : solved

2011-02-20 Thread Philip Webb
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.

-- 
,,
SUPPORT ___//___,   Philip Webb
ELECTRIC   /] [] [] [] [] []|   Cities Centre, University of Toronto
TRANSIT`-O--O---'   purslowatchassdotutorontodotca