- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Need help in script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-30-2009 09:03 AM
тАО01-30-2009 09:03 AM
Can some one please help me in this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-30-2009 09:20 AM
тАО01-30-2009 09:20 AM
Solution# cat ./pinghosts
#!/usr/bin/sh
while read HOST X
do
ping ${HOST} -n 1 >/dev/null 2>&1
[ $? = 0 ] || echo "'${HOST}' does not answer"
done < pinghosts.lst
exit 0
# cat ./pinghosts.lst
hostname1
hostname2
hostname3
...run as:
# ./pinghosts
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-30-2009 10:50 AM
тАО01-30-2009 10:50 AM
Re: Need help in script
I tried this script as follows:
I made a list of all the printers as pinghosts.lst and then ran your script. It only points out the printers who are not present in DNS or failed in name resolution but not the ones who have been defined in DNS but are not pingable.
ping aguawhinv2200 -n 2
PING aguawhinv2200.col.com: 64 byte packets
----aguawhinv2200.col.com PING Statistics----
2 packets transmitted, 0 packets received, 100% packet loss
/home/root # echo $?
0
As you can see, it returns a code 0 for the host who is defined in DNS but you cant ping it as it is down or unavailable.
Can you please give me some guidance in this regard?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-30-2009 11:07 AM
тАО01-30-2009 11:07 AM
Re: Need help in script
Sorry about that. Try this:
#!/usr/bin/sh
while read HOST X
do
ping ${HOST} -n 1 | grep -q "100% packet loss" && echo "'${HOST}' is down"
done < hostlist
exit 0
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-30-2009 11:17 AM
тАО01-30-2009 11:17 AM