JOSE NG LEE wrote in a message to Mike Bilow:

 JNL> Can someone help me with a script or supply me with a script
 JNL> to detect first when my ppp connection is up and working for
 JNL> then to execute the line to update my current IP address.

>From the "ping" man page:

     If ping does not receive any reply packets at all it will exit with code
     1.  On error it exits with code 2. Otherwise it exits with code 0. This
     makes it possible to use the exit code to see if a host is alive or not.

The simplest possible shell script -- although not the most robust -- is:

   #!/bin/sh

   IPADDRESS='198.41.0.5'

   until ping -c 1 "$IPADDRESS" ; do
        echo "Not yet..."
        sleep 5
   done

   echo "Now connected!"

Obviously, choose something reasonable for the target IP address.
 
-- Mike

Reply via email to