Re: ssh session doesn't terminate until programs are closed
On Wed, Dec 19, 2001 at 10:00:23AM +0200, Hugo van der Merwe wrote:
> I was wondering about an ssh session not closing until all the programs
> started in it are closed. How can I change this behaviour? Or maybe
> better, how can I modify my program to not be one of the programs it
> waits for? (Currently I fork() once and only the child branch continues.
> This does look like it backgrounds the program fine...)
see http://www.openssh.com/faq.html#3.10 which (for shell) recommends a
shopt -s huponexit, but fails to mention subsequently protecting child
processes with nohup(1) and/or the "disown" bash builtin; you may also
need to close stdio with the <&- >&- redirections - and closing stdin &
stdout is your alternative anyway (proper daemonizing).
If coding in C, use daemon(3).