Hi Guys,
Currently, we are connecting windows machines via OpenSSH.
When we execute the remote command it always returns exits status 0
console output for ref.
=====================
[rd@dvserver143 dhana]$ ssh dvdev@10.10.1.216 'hostname'
WIN-7U3C8GAPDJI
[rd@dvserver143 dhana]$ echo $?
0
[rd@dvserver143 dhana]$ ssh dvdev@10.10.1.216 'hostname1'
/bin/sh: hostname1: command not found
[rd@dvserver143 dhana]$ echo $?
0
[rd@dvserver143 dhana]$
=====================
please guide me. How to fix this.
Regards
-Dhanasekaran.
The command you ran was ssh. It succeeded. This will not tell you what
the exit status is of the remote command.
You have to do that as part of the remote command.
0
[rd@dvserver143 dhana]$ ssh dvdev@10.10.1.216 'hostname1'
/bin/sh: hostname1: command not found
[rd@dvserver143 dhana]$ echo $?
0
[rd@dvserver143 dhana]$
=====================
please guide me. How to fix this.
ask the remote machine what the exit status was of the command you ran.
I have no idea if Windows will give you an exit status or not.
Regards
-Dhanasekaran.
The same command When I execute linux machine. I am able to get the exit-status properly.
so. the issue is the windows+opensshd is not properly returning the exit status code.
On 4/23/19 12:01 PM, Dhanasekaran Anbalagan wrote:
The same command When I execute linux machine. I am able to get the
exit-status properly.
The testing I just did (Linux to Linux) agrees with this.
so. the issue is the windows+opensshd is not properly returning the exit
status code.
I wonder if this has anything to do with the difference in exist status
vs ERRORLEVEL. As in if this is a Windows<ism> (formerly a DOS<ism>)
that isn't translating well.
Currently, we are connecting windows machines via OpenSSH.
When we execute the remote command it always returns exits status 0
console output for ref.
=====================
[rd@dvserver143 dhana]$ ssh dvdev@10.10.1.216 'hostname'
WIN-7U3C8GAPDJI
[rd@dvserver143 dhana]$ echo $?
0
[rd@dvserver143 dhana]$ ssh dvdev@10.10.1.216 'hostname1'
/bin/sh: hostname1: command not found
[rd@dvserver143 dhana]$ echo $?
0
[rd@dvserver143 dhana]$
=====================
please guide me. How to fix this.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 294 |
Nodes: | 16 (3 / 13) |
Uptime: | 248:23:20 |
Calls: | 6,627 |
Calls today: | 3 |
Files: | 12,175 |
Messages: | 5,320,996 |