HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: exit values when remsh
Operating System - HP-UX
1834936
Members
2194
Online
110071
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
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
05-09-2001 10:33 AM
05-09-2001 10:33 AM
exit values when remsh
Hello,
HPUX 11.0 64-bit, N4000
I'm writing a script that will execute scripts in a remote server using remsh, for example:
remsh myhost -n myscript.sh myfile 2>rmcmd.err \; echo $?
I'd like to know if there is a way to get the exit value of myscript.sh.
If I run myscript.sh locally in myhost, I get $? set to the correct exit value, but when I ran the above command on theotherhost I always get 0 no matter what.
Thanks in Advance,
Luis
HPUX 11.0 64-bit, N4000
I'm writing a script that will execute scripts in a remote server using remsh, for example:
remsh myhost -n myscript.sh myfile 2>rmcmd.err \; echo $?
I'd like to know if there is a way to get the exit value of myscript.sh.
If I run myscript.sh locally in myhost, I get $? set to the correct exit value, but when I ran the above command on theotherhost I always get 0 no matter what.
Thanks in Advance,
Luis
We'll get through this together.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2001 10:44 AM
05-09-2001 10:44 AM
Re: exit values when remsh
Hi Luis:
You have found a remsh and remshd feature. The 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=/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_coomand 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.
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.
Hopes this gets you started, Clay
Now imagine that
You have found a remsh and remshd feature. The 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=/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_coomand 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.
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.
Hopes this gets you started, Clay
Now imagine that
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2001 01:07 PM
05-09-2001 01:07 PM
Re: exit values when remsh
Hi,
I've tried to do what you want in a direct way as
follows:
remsh myhost 'myscript.sh myfile 2>rmcmd.err ;echo $?'
Remember, sorrounding remote command by ' ' is important.
Rgds.
I've tried to do what you want in a direct way as
follows:
remsh myhost 'myscript.sh myfile 2>rmcmd.err ;echo $?'
Remember, sorrounding remote command by ' ' is important.
Rgds.
Permanent training makes master
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