Hallo, In message <_A3386@delegate-en.ML_> on 07/12/06(17:11:50) you Steffen Kaiser <p44eqbdyi-mykgh4ywg4tw.ml@delegate.org> wrote: |when I start the delegate demon from within a SSH session, the session |hangs upon logout. Lately I came across the same problem for yet another |program, too, and there the problem was addressed to "demonize properly", |e.g. as described by: Hmm... Indeed since I recently started to use SSH to login to multiple Linuxes (on a VirtualPC), I have suffered this problem. But I didn't notice that it is caused by DeleGate, and have become used to do shutting down the SSH session with "~." each time :). I coded the daemonizing of DeleGate on SunOS4 which is based on BSD (when I hated SysV :), and recently living on MacOSX based on BSD, so I have not been able to notice the problem. |The most important trick is to fork() twice, so the process becomes its |own process group and is detached from any terminal and process group. I think it is the very functionarity of setsid() and it works as expected on BSD. I tested to close the standard input after setsid() as the enclosed patch, and it solved the problem of SSH on Linuxes I have (Debian3.1 and RedHat9). Cheers, Yutaka -- 9 9 Yutaka Sato <pfqcabdyi-mykgh4ywg4tw.ml@delegate.org> http://delegate.org/y.sato/ ( ~ ) National Institute of Advanced Industrial Science and Technology _< >_ 1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan Do the more with the less -- B. Fuller *** delegate9.2.3-pre12/src/delegated.c Sun Jul 9 20:24:15 2006 --- delegated.c Wed Jul 12 19:52:24 2006 *************** *** 1777,1784 **** --- 1777,1785 ---- if( !INHERENT_spawn() ){ if( Fork("daemon") != 0 ) _Finish(0); setsid(); + dup2(open("/dev/null",0),0); return; } if( isService ){ /* it is running as a service */ return;