On command: #kill -9 `cat /var/run/sshd.pid` sshd leave pid file ! sshd.c code: ==============.... /* * Arrange to restart on SIGHUP. The handler needs * listen_sock. */ signal(SIGHUP, sighup_handler); signal(SIGTERM, sigterm_handler); signal(SIGQUIT, sigterm_handler); .... ============== Missing line is : signal(SIGKILL, sigterm_handler);
On Thu, 5 Sep 2002 Roumen.Petrov at skalasoft.com wrote:> On command: > #kill -9 `cat /var/run/sshd.pid` > sshd leave pid file ! > > sshd.c code: > ==============> .... > /* > * Arrange to restart on SIGHUP. The handler needs > * listen_sock. > */ > signal(SIGHUP, sighup_handler); > > signal(SIGTERM, sigterm_handler); > signal(SIGQUIT, sigterm_handler); > .... > ==============> > Missing line is : > signal(SIGKILL, sigterm_handler);SIGKILL can not be caught. SIGKILL will always kill the process immediately. You should not kill sshd with SIGKILL, if you want it to do any cleanup. 'man signal' tells you this too. - Jani
On Thu, 5 Sep 2002 Roumen.Petrov at skalasoft.com wrote:> Missing line is : > signal(SIGKILL, sigterm_handler);No. Processes cannot catch SIGKILL. --- Aaron Campbell (aaron at monkey.org || aaron at openbsd.org) http://www.monkey.org/~aaron
Hi Roumen,> #kill -9 `cat /var/run/sshd.pid` > sshd leave pid file !> signal(SIGKILL, sigterm_handler);SIGSTOP and SIGKILL cannot be trapped. Chris -- Warning: do not look into laser with remaining eye -- http://www.jwz.org/ppmcaption/
Circa 2002-09-05 20:55:55 +0300 dixit Roumen.Petrov at skalasoft.com: : On command: : #kill -9 `cat /var/run/sshd.pid` : sshd leave pid file ! : : sshd.c code: : ==============: .... : /* : * Arrange to restart on SIGHUP. The handler needs : * listen_sock. : */ : signal(SIGHUP, sighup_handler); : : signal(SIGTERM, sigterm_handler); : signal(SIGQUIT, sigterm_handler); : .... : ==============: : Missing line is : : signal(SIGKILL, sigterm_handler); Ummm, no. Under traditional Unix, POSIX, BSD, and SysV, no signal handler may be set for either SIGKILL or SIGSTOP. Refer to: http://www.mcsr.olemiss.edu/cgi-bin/man-cgi?signal+3 http://www.mcsr.olemiss.edu/cgi-bin/man-cgi?sigvec+3 -- jim knoble | jmknoble at pobox.com | http://www.pobox.com/~jmknoble/ (GnuPG fingerprint: 31C4:8AAC:F24E:A70C:4000::BBF4:289F:EAA8:1381:1491) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 262 bytes Desc: not available Url : http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20020905/31048d41/attachment.bin
On Thu, Sep 05, 2002 at 08:55:55PM +0300, Roumen.Petrov at skalasoft.com wrote:> On command: > #kill -9 `cat /var/run/sshd.pid` > sshd leave pid file !so don't use kill -9. you should never use kill -9.
Hi, On Thu, Sep 05, 2002 at 08:55:55PM +0300, Roumen.Petrov at skalasoft.com wrote:> On command: > #kill -9 `cat /var/run/sshd.pid` > sshd leave pid file !Of course it does. "kill -9" means "abort process *immediately*" - no matter what you do, sshd has no means (!!) to clean up anything. So don't use "kill -9", except if nothing else works. Never. Use "kill -15" (which is SIGTERM, instead of SIGKILL) - this gives the process the chance to clean up.> Missing line is : > signal(SIGKILL, sigterm_handler);Read up on unix signal semantics. gert -- Gert Doering Mobile communications ... right now writing from *Ripe43 / Rhodos / Greece*
Sorry, I waste your time. Yes - processes cannot catch SIGKILL. When I swich one linux from multi user to single user mode I found in /var/run only sshd.pid. Script call kill -TERM pid after this kill -KILL pid. Problem is not in sshd !!! END OF DISCUSSION !!!