- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Doubt in remsh
Operating System - HP-UX
1823219
Members
3745
Online
109648
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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-21-2004 11:31 PM
тАО01-21-2004 11:31 PM
Doubt in remsh
Hi,
We are facing a problem in getting the exit status of a script run remotely.
For e.g.,
We have script1 running on server1 that executes script2 on server2 using remsh. "script2" may exit with status codes other than 0. We need script1 to capture that code. Is there any mechanism to do this.
We are working on HP-UX 11i.
The man pages do seem to suggest that it is not possible to get the exit status of a remotely run script. Just wanted to make sure.
Any information in this regard is appreciated.
Regards,
Ram.
We are facing a problem in getting the exit status of a script run remotely.
For e.g.,
We have script1 running on server1 that executes script2 on server2 using remsh. "script2" may exit with status codes other than 0. We need script1 to capture that code. Is there any mechanism to do this.
We are working on HP-UX 11i.
The man pages do seem to suggest that it is not possible to get the exit status of a remotely run script. Just wanted to make sure.
Any information in this regard is appreciated.
Regards,
Ram.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-21-2004 11:43 PM
тАО01-21-2004 11:43 PM
Re: Doubt in remsh
the exit code of 0 is from remsh itself.
What you need to do is display the exit code from the remote command to screen, then process the output locally.
You could set it up as a variable using the following;
export REMOTE_EXIT_CODE=`remsh server2 "script;echo $?"`
You can then use the value of REMOTE_EXIT_CODE in the script on server1 for verification that it has worked.
What you need to do is display the exit code from the remote command to screen, then process the output locally.
You could set it up as a variable using the following;
export REMOTE_EXIT_CODE=`remsh server2 "script;echo $?"`
You can then use the value of REMOTE_EXIT_CODE in the script on server1 for verification that it has worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-21-2004 11:43 PM
тАО01-21-2004 11:43 PM
Re: Doubt in remsh
Hi Ram,
Since Script2 is on server2 and runs on server2 i would alter that script with one line, echo $? >script2.exit. and alter your remsh command so
EXIT=remsh -n "script2 >>/dev/null ; cat script2.exit"`
if [ $EXIT -ne 0 ]
then
echo ": HELP!!!!"
fi
HTH,
Gideon
PS with ssh you can capture exit status of remote executed commands
Since Script2 is on server2 and runs on server2 i would alter that script with one line, echo $? >script2.exit. and alter your remsh command so
EXIT=remsh
if [ $EXIT -ne 0 ]
then
echo ": HELP!!!!"
fi
HTH,
Gideon
PS with ssh you can capture exit status of remote executed commands
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-21-2004 11:43 PM
тАО01-21-2004 11:43 PM
Re: Doubt in remsh
There may be a simpler way but this was the first thing that came to mind and it seems to work.
RET=`rsh hostname "false;echo \$?"`
echo $RET
This gives "1" in the above example which is correct. You'll have to do annoying stuff if the command you want to run actually has output.
RET=`rsh hostname "false;echo \$?"`
echo $RET
This gives "1" in the above example which is correct. You'll have to do annoying stuff if the command you want to run actually has output.
Never preceed any demonstration with anything more predictive than "watch this"
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP