[95980] in RedHat Linux List
Re: PING
daemon@ATHENA.MIT.EDU (Tim Hockin)
Thu Oct 22 16:41:21 1998
From: Tim Hockin <thockin@isunix.it.ilstu.edu>
To: linuxuser@linuxtest.fellows.denison.edu (Linux User)
Date: Thu, 22 Oct 1998 15:39:51 -0500 (CDT)
Cc: redhat-list@redhat.com
In-Reply-To: <Pine.LNX.3.96.981022150555.1242D-100000@linuxtest.fellows.denison.edu> from "Linux User" at Oct 22, 98 03:10:56 pm
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com
> What I need to do is ping the range, the output goes to a file and the
> file emailed to our Online Service Manager. What I'd really like is to be
> able to get a list of only the active IP's.
> My question is then, how do I do this on the command like for just one
> IP. as I use it right now it keeps pinging the address infinitly.
I am not sure I understand 100% what you want.
If you just want to run a ping once, or twice (rather than infinately) try
ping -c <COUNT> <HOST>
where <COUNT> is an integer > 0.
If you want to ONLY output hosts that succeed you can do something like:
ping -c 1 $HOST > /dev/null 2>&1 && echo $HOST is alive
If you want to output the results from the ones that succeed, something
like:
ping -c 1 $HOST > /dev/null 2>&1 && ping -c 1 $HOST | head -2
There are certainly ways to do it without pinging it twice, but that is
easy and fast. Like I said before, I put them in the background, and that
way the successes are fast, and the fails are slow.
does that help?
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com http://archive.redhat.com
To unsubscribe: mail redhat-list-request@redhat.com with
"unsubscribe" as the Subject.