RE: script or other suggestion
- From: "Broekman, Maarten" <Maarten.Broekman@xxxxxxx>
- Date: Fri, 23 Nov 2007 10:00:49 -0500
The command 'host' will look up an ip address and return the associated
hostname (if there is one).
The manpage should help.
Maarten Broekman
Email: maarten.broekman@xxxxxxx
-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx
[mailto:redhat-list-bounces@xxxxxxxxxx] On Behalf Of chloe K
Sent: Friday, November 23, 2007 9:55 AM
To: General Red Hat Linux discussion list
Subject: RE: script or other suggestion
Thank you
how to use dns lookups
thank you again
"Broekman, Maarten" <Maarten.Broekman@xxxxxxx> wrote: Why not just do
DNS lookups to see which ones are assigned?
To build on what Cameron mentioned, just put in "host $i" in the loop
and check to see it returns anything sane. If so, you might want to
ping it to see if it's up, but as Cameron said, the system could be down
or off so that's not 100% reliable.
Maarten Broekman
Email: maarten.broekman@xxxxxxx
-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx
[mailto:redhat-list-bounces@xxxxxxxxxx] On Behalf Of Cameron Simpson
Sent: Thursday, November 22, 2007 4:10 PM
To: General Red Hat Linux discussion list
Subject: Re: script or other suggestion
On 22Nov2007 15:35, chloe K wrote:
| I have ip list in my network
| I need to check which ip is unused
| what is better solution?
|
| Write the ping script or use other command
|
| eg:
|
| for i in ip.txt
| ping -c 3 $i
That would be:
for i in `cat ip.txt`
do ping -c 3 $i || { echo "IP $i is not in use."; break; }
done
Of course, if a machine happens to be down/off, if will look
like its IP is not in use...
You could possibly do something clever with nmap or "ping -b",
but your approach is simple and effective.
--
Cameron Simpson DoD#743
http://www.cskk.ezoshosting.com/cs/
Getting a SCSI chain working is perfectly simple if you remember that
there
must be exactly three terminations: one on one end of the cable, one on
the
far end, and the goat, terminated over the SCSI chain with a
silver-handled
knife whilst burning *black* candles. - Anthony DeBoer
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
---------------------------------
Instant message from any web browser! Try the new Yahoo! Canada
Messenger for the Web BETA
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
- References:
- RE: script or other suggestion
- From: chloe K
- RE: script or other suggestion
- Prev by Date: RE: script or other suggestion
- Next by Date: RE: script or other suggestion
- Previous by thread: RE: script or other suggestion
- Next by thread: RE: script or other suggestion
- Index(es):
Relevant Pages
- Getting "date" command to output the date in milli-seconds - Possible or not?
... Can anyone tell me if it is possible to get the AIX "date" command to output ...
I need this to log the start time of a regularly called script. ... milli-seconds
for logging purposes, and to aid in finding out why the remote ... host experiences a double
call sometimes. ... (comp.unix.aix) - Re: How to get ssh to work in a loop
... > script for the sun systems which was quite easy as you only need to ...
Drop cat (useless use of this command). ... I believe other UNIX systems) is to
continually ping if 'ping HOST' is ... Running multiple ssh calls to the same system
in a loop ... (comp.unix.shell) - Re: How to get ssh to work in a loop
... >>script for the sun systems which was quite easy as you only need to ...
>>run one command and grep for largefiles. ... > I believe other UNIX systems)
is to continually ping if 'ping HOST' is ... Running multiple ssh calls to the same
system in a loop ... (comp.unix.shell) - Re: ssh in bash script
... > back at prompt in host1. ... > how to make it continue on in the script?
... ssh user@host "command" ... user is your username on the remote host.
... (Fedora) - Re: forcing STDOUT.sync for scripts
... This last suggestion would be great, ... Ruby doesn't ... run
the script given at the end of the command line if you have one or ... (comp.lang.ruby)