- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- remsh in a loop
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
тАО04-04-2005 03:27 AM
тАО04-04-2005 03:27 AM
Long time :-). I would like to think myself as a reasonably skilled scripter but this one baffled me. I just could not figure out what am I missing here.
I have this file serverlist that lists all the servers with some comments in between
# grep -v "^#" serverlist | wc -l
109
#
All I am trying to do is to execute a simple command via remsh to all of the machines from a node that has .rhosts entries
# grep -v "^#" serverlist | awk '{print $1}' | xargs -n1 | while read SERVERNAME
> do
> remsh $SERVERNAME "echo Hey"
> done
Hey
Hey
#
Why on the god's green earth the loop will exit just after two iteration? Even if there is something wrong, I should get an error message from remsh
# grep -v "^#" serverlist | awk '{print $1}' | xargs -n1 | while read SERVERNAME
> do
> echo $SERVERNAME
> done | wc -l
109
#
Am I missing something very obvious?
- Sundar.
Solved! Go to Solution.
- Tags:
- remsh
- while loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2005 03:45 AM
тАО04-04-2005 03:45 AM
Re: remsh in a loop
xargs -i echo remsh {} "some command"
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2005 03:54 AM
тАО04-04-2005 03:54 AM
Re: remsh in a loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2005 05:50 AM
тАО04-04-2005 05:50 AM
Re: remsh in a loop
check "which grep" you are using.
check "which awk" you are using.
check "which xargs" you are using.
check "chich remsh" you are using.
Also, try replacing the remsh $SERVERNAME line with this:
host ${SERVERNAME}
just to make sure you have "good" server names.
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2005 06:08 AM
тАО04-04-2005 06:08 AM
Re: remsh in a loop
for SERVER in `grep -v "^#" serverlist | awk '{print $1}' | xargs -n1 `
do
echo "$SERVER"
remsh $SERVER "echo hey"
done
Can you post your serverlist file?
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2005 06:18 AM
тАО04-04-2005 06:18 AM
Re: remsh in a loop
Harry - if there are funky names, how do you think xargs -i remsh {} is working ?
grep -v "^#" serverlist | awk '{print $1}' | xargs -i remsh {} date
this work. Doesnt it confirm the grep, awk ,xargs and the serverlist are just fine ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2005 06:23 AM
тАО04-04-2005 06:23 AM
Re: remsh in a loop
remsh $SERVERNAME "echo Hey"
to
remsh $SERVERNAME /usr/bin/echo Hey
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2005 08:01 AM
тАО04-04-2005 08:01 AM
Re: remsh in a loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2005 08:18 AM
тАО04-04-2005 08:18 AM
Re: remsh in a loop
Just a wild guess :-)
Does your serverlist file have a comment which
starts in the middle of a line? In other words, do
you have a '#' char at some place other than
first column?
- Biswajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2005 08:46 AM
тАО04-04-2005 08:46 AM
Re: remsh in a loop
Can you post your "input" file "serverlist" ??
thanks,
live free or die
harry d brown jr