*BSD News Article 73039


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!dispatch.news.demon.net!demon!awfulhak.demon.co.uk!awfulhak.demon.co.uk!awfulhak.demon.co.uk!not-for-mail
From: brian@awfulhak.demon.co.uk (Brian Somers)
Newsgroups: comp.sys.sun.admin,alt.sys.sun,comp.unix.bsd.misc,comp.unix.programmer,comp.unix.bsd.bsdi.misc,comp.unix.admin
Subject: Re: ping script
Followup-To: comp.sys.sun.admin,alt.sys.sun,comp.unix.bsd.misc,comp.unix.programmer,comp.unix.bsd.bsdi.misc,comp.unix.admin
Date: 5 Jul 1996 13:52:40 -0500
Organization: Coverform Ltd.
Lines: 26
Message-ID: <4rjo9o$gn@anorak.coverform.lan>
References: <Pine.SOL.3.93.960702171209.4062B-100000@gold.acns.fsu.edu> <31DA8A95.61BB@hybrid.com>
NNTP-Posting-Host: localhost.coverform.lan
X-NNTP-Posting-Host: awfulhak.demon.co.uk
X-Newsreader: TIN [version 1.2 PL2]
Xref: euryale.cc.adfa.oz.au comp.sys.sun.admin:70083 alt.sys.sun:10377 comp.unix.bsd.misc:1218 comp.unix.programmer:39195 comp.unix.bsd.bsdi.misc:4257 comp.unix.admin:44536

Kenneth Coley (coley@hybrid.com) wrote:
: Just look at the exit status:

: :
: for i in `cat ipnums`
:   do
:   ping $i > /dev/null 2>&1
:   ping $i > /dev/null 2>&1
:   if [ $? = 0 ]
:     then
:     runactive
:   else
:     runnoanswer
:   fi
: done

: Use two pings just because of routing issues, the 
: first ping may get an error.  The second ping will 
: verify that the node is really missing.

Despite the return code on FreeBSD being correct, historically, it is not
guaranteed.  If you want to write a portable script, don't do it this way.

--
Brian <brian@awfulhak.demon.co.uk>
Don't _EVER_ lose your sense of humour....