Re: logout from ssh session

From: Greg Wooledge (wooledg_at_eeg.ccf.org)
Date: 01/14/04

  • Next message: B: "Re: logout from ssh session"
    Date: Wed, 14 Jan 2004 08:39:25 -0500
    To: David Danovich <do***@yfaat.ch.huji.ac.il>
    
    

    On Tue, Jan 13, 2004 at 09:15:52PM +0200, David Danovich wrote:
    > run &

    > able to logout from the computer. When I write logout computer just
    > freeze and wait till job finished.

    http://www.openssh.com/faq.html#3.10

    However, I'd like to point out that the answer in the FAQ is somewhat
    incomplete. If you run "shopt -s huponexit" (in bash) and then
    "nohup sleep 300 &", then the job gets the HUP signal but *does not die*
    (because of the nohup), and then the ssh client (**NOT** the computer!)
    hangs, as you have experienced. The "shopt -s huponexit" is only useful
    if you want to kill the background job that's causing the ssh client
    to hang, which defeats the whole purpose of running the job in the
    background in the first place! (Duh!)

    Redirecting stdout and stderr to /dev/null (or a log file) is the only
    way to let the ssh client terminate when you exit with a background job
    running. (Even bash's "disown" won't work. I just tried it.)

    This is also an *extremely* frequently asked question on this list. I've
    beaten it to death already. Unfortunately, I can't seem to find a
    searchable archive of this list anywhere. (The web interface at
    http://www.securityfocus.com/archive/ leaves a bit to be desired!)
    Nevertheless, a few Google searches for phrases like "openssh background
    job hangs client" might turn up some of the past discussion.


  • Next message: B: "Re: logout from ssh session"
  • Quantcast