Operating System - HP-UX
1821051 Members
2754 Online
109631 Solutions
New Discussion юеВ

ssh and background processes - processes hang

 
SOLVED
Go to solution
Kevin Liquori_1
Regular Advisor

ssh and background processes - processes hang

I've been reading the forum posts concerning ssh and sessions that hang when a process runs in the background. For example:

ssh myserver
nohup sleep 200 &
Ctrl-D

Connection now hangs. I was hoping an upgrade to HP's 4.30 secure shell would remedy this problem but it doesn't seem to. I've seen two solutions posted so far:
1) nohup command /dev/null 2&>1 --> this works but complicates script writing, especially when I'm not the one writing the script!
2) run a cron job to kill sshd sessions with 'notty' in the ps -ef output. This idea seemed more intriguing. It worked until I upgraded to 4.30. Now I never see notty in the output!

I'm disappointed that HP keeps releasing upgrades to secure shell without fixing this bug. Considering that I want to upgrade to the latest version, does anyone know if there's a way to get the notty output back? Any other imaginative ideas on how to deal with this. Has anyone compiled from the source with different results?

TIA...Kevin
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: ssh and background processes - processes hang

Shalom Kevin,

Change ssh to ssh -vvv above.

See what happens.

Also check the swinstall log from secure shell.

You can swremove this version and install version 4.2

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Kevin Liquori_1
Regular Advisor

Re: ssh and background processes - processes hang

When I run ssh -v the last line of the debug info is:

debug1: client_input_channel_req: channel 0 rtype exit-status reply 0

It hangs at this point. Do you know if HP keeps older versions off ssh available? I only see 4.30 on software.hp.com.

Thanks!
...Kevin
Steven E. Protter
Exalted Contributor
Solution

Re: ssh and background processes - processes hang

Shalom Kevin,

If you have a software contract, you may open a call at the response center. They are permitted to grant you access to an ftp site with the version of ssh you need.

If you can't do that, click my profile, use the contact form to send me an email and I'll make arrangements for you to get the last 4.2 version.

HP might pull the version on software.hp.com and put the previous back if there is a serious flaw. This can be reported via the response center regardless of whether you have a software contract or not.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com

Re: ssh and background processes - processes hang

Kevin,

Don't know if this helps...
But, we've started using "at" jobs to circumvent the problem.

at -f some_script now

Just a thought....

Ted
Doug O'Leary
Honored Contributor

Re: ssh and background processes - processes hang

Hey;

It's not a bug; that's the way it's supposed to work. When you "ssh myserver" you're opening up a tty that stays open until all commands in it are done. Since you nohup'ed sleep 200, it's going to wait until the sleep 200 is done. In theory, the nohup is supposed to disassociate the tty from the command. I've had issues on HPs with it doing that even straight which is why I tend to use "at now" commands.

The same thing happens if you ssh to a server, open up an X based GUI, then try to exit. As long as the X gui is running, your ssh will appear to have hung when you try to exit.

You can try using the -T option to disable tty allocation. I haven't tried that so I'm not sure if it'll do what you're looking for.

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Kevin Liquori_1
Regular Advisor

Re: ssh and background processes - processes hang

Steven, thanks for the offer, but I do have a software contract with HP so I'll contact them. I didn't realize that ftp resource was there though, that's great!

Doug, I just tried the '-T' option but it behaves the same way. Also, your explanation of nohup behavior helps clarify some things.

Ted & Doug, normally 'at' would work fine. The current problem I'm wrestling with is launching multiple scripts during a backup. Some servers ssh over to other servers to restart applications which are effectively nohup's.

With all of this in mind I'm going to stop wrestling with ssh (since it's behaving correctly) and re-engineer how we run our backup scripts.

As always, many thanks, all!
...Kevin