Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with ssh not returning

Status
Not open for further replies.

yaff1e

Programmer
Apr 5, 2011
3
0
0
GB
I am currently porting some legacy code into a new scheduling system. It runs on a number of source servers and invokes the following on a number of target servers. All servers are running Solaris 10.

The command at issue is:
Code:
ssh -o "BatchMode=yes" ${TARGET_USER}@${TARGET_HOST} "${TEST_SCRIPT} </dev/null 2>&1 | egrep ^${TEST_RESULT}$ >/dev/null 2>&1"
The $? return value for this command is then tested for success before continuing the processing.

What seems to be happening, on some but not all server combinations, is that the remote script is executed and egrep succeeds (I changed the last /dev/null to /var/tmp/x to check), but the sshd process at the target end, and the ssh at source remain without terminating.

I understand that there is an issue with sshd not terminating until it receives EOF, but the suggested workaround (cf. is to re-direct output to /dev/null, which I think I'm already doing.

Am I missing something? Is there anything aside from the EOF not being received that might cause this behaviour?
 
The solution seems to have been to add the -n flag to the ssh call, so presumably it was the input channel that was still deemed open.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top