chill wrote: 
> 
> More good advice, thank you.  But why is it a bad habit?
> 
> 

When a process receives a signal, it usually has a chance to do
something -- in fact, some signals are -only- used for "doing
something", and don't kill a process by default.  They might be used to
tell the process to re-read its config file, for instance.  But even if
it's being told to die (which is what SIGTERM, the default signal from
kill) is usually used for, it still might want to flush some output
buffers, or if it has created its own pidfile, it might want to remove
it.  At the very least, the process might want to log that it's dying
because of a signal.  So it would do any of those things before calling
exit.

Now, a misbehaved (or buggy) process might catch your SIGTERM signal and
then not exit.  That's what SIGKILL (i.e., kill -9) is for.  SIGKILL
can't be caught and handled by a process -- it just kills it
immediately.  If you use it by habit, you may be preventing the process
you're killing from doing an orderly shutdown.  Kind of like pulling the
plug on your PC instead of typing shutdown.  It'll usually be fine when
you start it back up, but then that one time....   ;-)


------------------------------------------------------------------------
pgf's Profile: http://forums.slimdevices.com/member.php?userid=58510
View this thread: http://forums.slimdevices.com/showthread.php?t=113661

_______________________________________________
unix mailing list
unix@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to