On Fri, Mar 26, 2004 at 05:14:51PM +1100, Amanda wrote:

> I'm looking for a bash script which will periodically (launched from
> cron) ping a machine on the remote network and restart pptp if it 
> doesn't respond.

Just use the exit status of ping, e.g.:

    ping -nqc 1 $remote_host > /dev/null 2>&1
    if [ $? -ne 0 ]
    then
        link_down=0
    else
        link_down=1
    fi

and do whatever you need to do based on $link_down.



Cheers,

John
-- 
"Now that I think of it, O'Reilly is to a system administrator as a shoulder
length latex glove is to a veterinarian." - Peter da Silva
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to