- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Shell Script for grep one IP from one server a...
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
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
тАО03-05-2009 10:56 PM
тАО03-05-2009 10:56 PM
Shell Script for grep one IP from one server and ping to another
My enviorment got two node cluster and on primary node i've configration file which consist the IP address and i want to grep this Ip and ping this IP address from secondry node. please help. thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-05-2009 11:12 PM
тАО03-05-2009 11:12 PM
Re: Shell Script for grep one IP from one server and ping to another
If it just contains IP addresses you can do:
for m in $(< file); do
ping $m -n 2
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-05-2009 11:15 PM
тАО03-05-2009 11:15 PM
Re: Shell Script for grep one IP from one server and ping to another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-05-2009 11:18 PM
тАО03-05-2009 11:18 PM
Re: Shell Script for grep one IP from one server and ping to another
the below script what i've written, but my problem is how should i break my inner loop to restart the script again...
#!/bin/sh
for i in `cat /var/adm/crash/list`
do
remsh $i grep xx /etc/hosts > sss
OUT=$(awk '{print $2}' sss)
for l in `cat list2`
do
echo "#############"
echo $l
echo "#############"
remsh $l /etc/ping $OUT -n 4
echo
echo
done
\rm sss
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-05-2009 11:40 PM
тАО03-05-2009 11:40 PM
Re: Shell Script for grep one IP from one server and ping to another
If your script is running fine then use while loop it will run till you break the loop with CTRL+C
while true
do
for i in `cat /var/adm/crash/list`
do
remsh $i grep xx /etc/hosts > sss
OUT=$(awk '{print $2}' sss)
for l in `cat list2`
do
echo "#############"
echo $l
echo "#############"
remsh $l /etc/ping $OUT -n 4
echo
echo
done
\rm sss
done
done
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-05-2009 11:53 PM
тАО03-05-2009 11:53 PM
Re: Shell Script for grep one IP from one server and ping to another
Then why won't you let ServiceGuard handle this ? It has built-in functionality to monitor IP-traffic to a card and restart/switch software when communication dies.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-06-2009 12:01 AM
тАО03-06-2009 12:01 AM
Re: Shell Script for grep one IP from one server and ping to another
You can add "-m timeout" so ping times out.