Thanks
Norm
Check if ping succeeds. Some versions of ping set their exit status based
on their success, so you can use it in an if statement.
--
Barry Margolin, bar...@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
Or get a copy of "fping", as i remember it it pings a list of
hosts and has possibilties to act if one host does not respond.
fping is available in FreeBSD ports tree.
> Check if ping succeeds. Some versions of ping set their exit status based
> on their success, so you can use it in an if statement.
> --
> Barry Margolin, bar...@bbnplanet.com
> GTE Internetworking, Powered by BBN, Burlington, MA
> *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
> Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
--
--
Peter Håkanson Phone +46 0708 39 23 04
Network Management AB Fax +46 031 779 7844
Email : use peter (at) gbg (dot) netman (dot) se No copy to sanford wallace!
Another utility that I have used fot this purpose is rup. It isn't
available on all systems, but it returns a list of hosts running on
the local net. It can take a while to run, if your net is highly
volatile it may not be suitable. The scripts I wrote to use it kept
a log of successes and failures and tried again later, but I had a
pretty stable network of Unix boxes.
On Tue, 23 Feb 1999, Barry Margolin wrote:
> In article <01be5f47$673c62c0$8aea689b@w784749>,
> Norm Dresner <nd...@worldnet.att.net> wrote:
> >I'd like to implement a shell that does something on each host on the
> >network that's up and running. I have (elsewhere) a list of possible
> >hosts. What's the simplest and fastest command to use in a shell to
> >determine in a for-loop for each one in turn whether or not it's up?
>
> Check if ping succeeds. Some versions of ping set their exit status based
> on their success, so you can use it in an if statement.
>
> --
> Barry Margolin, bar...@bbnplanet.com
> GTE Internetworking, Powered by BBN, Burlington, MA
> *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
> Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
>
>
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Cal Dunigan c...@goodnet.com There is something fundamentally
Consulting wrong with a world in which Ken
Modeling Thompson lives in obscurity and
Training Bill Gates is a famous billionaire.
//////////////////////////////////////////////////////////////////////
"rup"
Michael
--
"Life is not a dress rehearsal" -- unknown
Michael Nelson San Francisco, CA nel...@imat.com
rup depends on the hosts being available over RPC, and the rpc.statd
or rstatd daemon must be running on all hosts.
I'd say the fastest way to check which hosts are up on one network,
provided they are all physically located behind the same switch/router,
is to ping the broadcast or network address once, and check "arp -a".
At least if the hosts will answer broadcast pings :-)
Regards,
--
*Art
Why don't ping the broadcast adress and then use arp?
This way you get a list of all hosts up and running.
Jan
> Or get a copy of "fping", as i remember it it pings a list of
> hosts and has possibilties to act if one host does not respond.
>
> fping is available in FreeBSD ports tree.
I did a NetBSD port, if anyone is interested (It's juste changing 3
lines in the sources)
--
Emmanuel Dreyfus.
Avec Windows 3.1 ils etaient au bord du gouffre...
Avec Windows 95 ils ont fait un grand bon en avant.
p99d...@criens.u-psud.fr
Opinions expressed herein are my own and may not represent those of my employer.
> Why don't ping the broadcast adress and then use arp?
> This way you get a list of all hosts up and running.
A lot of TCP/IP implementations won't respond to a broadcast ping. Windows
comes to mind here... :-(
--
J. S. Jensen
mailto:jsje...@Paramin.COM
http://www.Paramin.COM
This is actually a good thing though... the fewer implementations that are
out there that respond to broadcast pings, the fewer places that DOS
attackers can use to launch smurf attacks.
--
--------------------------------------------------------------
Brian Smith Software Developer/Programmer at Large
aval...@earthling.net http://home.dreamhaven.org/~morph/
--------------------------------------------------------------
It is a little known fact that Y1K caused the Dark Ages...
Wrong group..
This is Silicon Graphics... Using Irix... Duhhh
John Snape
Senior Systems Specialist
Systems and Simulation
British Aerospace MA&A
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
This works in Solaris to make sure every machine is up:
-------------------------------------------------------------
#!/bin/sh
#check.hosts
# See if any of the hosts are down and report if they are
HOSTS=`cat /export/admin/scripts/HOSTS`
echo "Ping all machines and report hostname only if it is not pingable
" >> /export/admin/logs/checkh
ost.log
for x in $HOSTS ;do
ping $x 5 > /dev/null
if [ $? = 0 ]; then
echo "$x" > /dev/null
else
echo "$x is not on-line" >> /export/admin/logs/checkhost.log
fi
done
# mail the stuff to sys admin
#
/usr/ucb/mail -s "CheckHost" unixrepair <
/export/admin/logs/checkhost.log
# Clean Up After ourselves
rm /export/admin/scripts/checkhost.log
-------------------------------------------------------------------
Then have a file named HOSTS and put the name or IP address of the
machines you want to check. I've got this running as a crontab script
once an hour and I catch outages rather well like that.
Dan H