For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > October 2005 > HUP vs signal 9









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author HUP vs signal 9
Christopher Spears

2005-10-24, 6:56 pm

What is the difference between

kill 1, SIGNAL

and

kill 9, SIGNAL ?

By reading books and talking to people, I figured out
that kill 1 is the HUP (hang up signal) and kill 9 is
the kill signal. Don't they do the same thing (i.e.
terminate a program)? I was told that kill 1 is a
"nicer" way to end a program than kill 9.

Wiggins d'Anconia

2005-10-24, 6:56 pm

Christopher Spears wrote:
> What is the difference between
>
> kill 1, SIGNAL
>
> and
>
> kill 9, SIGNAL ?
>
> By reading books and talking to people, I figured out
> that kill 1 is the HUP (hang up signal) and kill 9 is
> the kill signal. Don't they do the same thing (i.e.
> terminate a program)? I was told that kill 1 is a
> "nicer" way to end a program than kill 9.
>
>


HUP is a catchable signal. Meaning the program receives notification
that a signal has occurred and which signal. This allows the program to
then act in a certain appropriate manner. For example, HUP is often used
to restart a server application such as Apache. Generally the server
will clear its configuration, re-read its configuration, and then
re-perform any startup like stuffs. The KILL (9) signal is not catchable
and causes an immediate death without proper cleanup. It is usually
reserved for a runaway process that can't be killed with one of the
other catchable kill signals like TERM or QUIT.

perldoc perlipc

For more about signals and their handling in Perl.

man -s 7 signal

For more about Unix/POSIX signals.

http://danconia.org
John W. Krahn

2005-10-24, 6:56 pm

Christopher Spears wrote:
> What is the difference between
>
> kill 1, SIGNAL
>
> and
>
> kill 9, SIGNAL ?
>
> By reading books and talking to people, I figured out
> that kill 1 is the HUP (hang up signal) and kill 9 is
> the kill signal. Don't they do the same thing (i.e.
> terminate a program)? I was told that kill 1 is a
> "nicer" way to end a program than kill 9.


Actually SIGTERM is the "nicer" way to end a program and if that doesn't work
then use SIGKILL. SIGHUP is usually used to tell a program to reread its
configuration files and start anew.


John
--
use Perl;
program
fulfillment
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com