On Thu, 15 Aug 2002, Randy Kramer wrote:

> I'm getting close on my email server (using fetchmail, postfix,
> procmail, ipopd (and maybe later imapd) -- in fact, if you see this it
> came from my Windows box via the Linux email server. ;-)
> 
> But, I have some bugs to work out yet, and some questions:
> 
> Questions:
> 
> 1.  Anybody know a good way to detect that a network link is active?  
> Background:
> 
> My connection to the Internet is via a dial up on another box (Dos, as a
> matter of fact.)  I would like to set up a cron job (and script) to do
> something like the following:
>    * Confirm the connection to my ISP is up (ping him, check for
> success?)
>    * If no: wake it up (ping it), and after so many tries, quit and give
> a message somewhere (and if it wakes up, proceed to the if yes)
>    * If yes:
>       * Run fetchmail to get mail
>       * Run sendmail -q to kick the queue and send any outgoing mail
> (I've set defer_transports=SMTP)
> 
> The reason I want to make sure the link is up before I kick the queue is
> so that the "exponential backoff" doesn't go into effect and result in
> outgoing messages sitting in the server for long periods of time (or
> even getting "failure to deliver" "bounces" from my own server).
> 
> Is that an unrealistic concern?  Is there a better way to deal with it?
> 

Here's a script that I use to check connectivity:

                                                                                    
  #!/bin/bash  
  STATUS=`ping -c 2 -q 11.22.33.44 2>/dev/null`
  CODE=$?

  if [ $CODE -gt 0 ]; then
     echo Link is down.
  else
     echo Link is up.     
  fi
  
  
Replace the 11.22.33.44 with a host on the internet. I use the
nameserver of the ISP but you can use any reliable address.
This script segment is part of a larger one to reboot my DSL modem via
X10, but you can modify it for dialup. There are also other ways of
dialing on demand such as "diald" that may be more effective.


Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to