HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Exit status of remote command
Operating System - HP-UX
1833883
Members
1860
Online
110063
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
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
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-31-2003 10:52 AM
01-31-2003 10:52 AM
Hello Experts,
I have a problem getting the exit status of a remsh'ed command
back on my local host. My real problem is that both stdout and stderr are needed and can't be used to echo the status.
I'm stuck. Any ideas?
Thanks,
Derek
I have a problem getting the exit status of a remsh'ed command
back on my local host. My real problem is that both stdout and stderr are needed and can't be used to echo the status.
I'm stuck. Any ideas?
Thanks,
Derek
Solved! Go to Solution.
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2003 10:58 AM
01-31-2003 10:58 AM
Solution
I remember answering one very much like this a while back:
---------------------------
The remsh exit code of 0 only means that the script was able to be launched. The exit status of the remote command is not returned. There is a workaround I have used for a long time.
REM_ERR_FILE=/var/tmp/x${$}.err
remsh remote_host my_command ${REM_ERR_FILE}
LOCAL_STAT=${?}
${LOCAL_STAT} only tells us about the success of remsh itself .
Now my_command on the remote host can get the
value of ${REM_ERR_FILE}; any status values you are interested in can be written to that file by your script on the remote host.
When the remsh command finishes you can then
REM_STAT=$(remsh remote_host cat ${REM_ERR_FILE})
to capture the remote commands status. (You should then issue a final remsh to remove the ${REM_ERR_FILE}.)
It's a little complicated but it does work. Since we generate a process id dependent filename on the local host, you don't have to worry about filename collision when multiple instances are running. This method also leaves stderr and stdout for their normal use.
This should do the trick for you,
Clay
---------------------------
The remsh exit code of 0 only means that the script was able to be launched. The exit status of the remote command is not returned. There is a workaround I have used for a long time.
REM_ERR_FILE=/var/tmp/x${$}.err
remsh remote_host my_command ${REM_ERR_FILE}
LOCAL_STAT=${?}
${LOCAL_STAT} only tells us about the success of remsh itself .
Now my_command on the remote host can get the
value of ${REM_ERR_FILE}; any status values you are interested in can be written to that file by your script on the remote host.
When the remsh command finishes you can then
REM_STAT=$(remsh remote_host cat ${REM_ERR_FILE})
to capture the remote commands status. (You should then issue a final remsh to remove the ${REM_ERR_FILE}.)
It's a little complicated but it does work. Since we generate a process id dependent filename on the local host, you don't have to worry about filename collision when multiple instances are running. This method also leaves stderr and stdout for their normal use.
This should do the trick for you,
Clay
If it ain't broke, I can fix that.
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
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP