We have several scripts on remotehost which we trigger from my localhost using ssh like below.
ssh remuser@remhost sh /web/bin/stop.sh
We had OS patching activity this weekend post which the above ssh command never returns and feels like it is hung or waiting for input.
It may be difficult to get details regarding what patch was applied to the OS.
Here are the details of the stop.sh
cat stop.sh
exec /usr/bin/java -jar /web/service.jar -DLOG_PATH=/web/logs --server.address=10.23.41.211 --server.port=10500 --spring.profiles.active=dev >> /web/logs/boot.log
exit 0;
First, we tried this solution from this forum but it does not return.
ssh remuser@remhost 'sh /web/bin/stop.sh my.jar dev &> /dev/null < /dev/null'
Debug output of ssh -vv
when it freezes and does not return is below:
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: chan_shutdown_read (i0 o0 sock -1 wfd 4 efd 6 [write])
debug2: channel 0: input open -> closed
We then tried the below and the ssh started returning but was unable to run the script on the remote host.
ssh -fN remuser@remhost sh /web/bin/stop.sh my.jar dev
Note: ssh remuser@remhost id
does return and works fine. Other scripts also work fine.
The issue is only with the scripts that have <or <<
or > or >>
where the control returns back to the invoker host.
Can you please suggest?
Note: There is no reason to debug the scripts. They are not the cause of issue as all the script are different and some very simple.
ssh remuser@remhost id
return a value? (Not interested in what the value is, just whether it returns one.) If it does then the problem is in your script. This is basic diagnosis 101ssh remuser@remhost id
returns value. Also update the original post withssh -vv
debug output/web/bin/stop.sh
(or some other script that reproduces the problem). What exactly means "was unable to run the script on the remote host"? Please copy&paste the exact error message to your question.