in reply to wierd wierd behavior with SIGTERM and classes

On UNIX systems, signals are subject to rules defined by process groups, process group leaders, and controlling terminals. There are a number of write-ups on this you should read up on.

SIGTERM is a signal that gets propogated to a process group. The common example is if your shell goes away, then any processes it started also die. A process can disassociate itself from its parent process group and become a true daemon by making certain system calls. These are often UNIX-specific. At my first job (C programming) we wrote a daemonize function that hid these details. That code was lifted almost directly out of the book UNIX Network Progamming by Richard Stevens.

  • Comment on Re: wierd wierd behavior with SIGTERM and classes

Replies are listed 'Best First'.
Re: Re: wierd wierd behavior with SIGTERM and classes
by shrubbery (Acolyte) on Feb 28, 2002 at 22:01 UTC
    I have been reading a few articles on it and have to elaborate some.

    First, it's a Solaris 5.6 box with perl 5.6.0. Also, I've run other scripts that uses this class almost identically and this behavior doesn't happen. That is what's baffling and I'm not sure where to look. I'm not too sure about your theory of kill sending SIGTERM to an entire group. I found this little writeup that basically says, you make the number negative to send to a group. I'm definately not sending it negative.

    kill

    Specifies a decimal integer representing a process or process group to be signaled. If PID is a positive value, the kill command sends the process whose process ID is equal to the PID. If the PID value is 0, the kill command sends the signal to all processes having a process group ID equal to the process group ID of the sender. The signal is not sent to processes with a PID of 0 or 1. If the PID is -1, the kill command sends the signal to all processes owned by the effective user of the sender. The signal is not sent to processes with a PID of 0 or 1. If it is a negative number but not -1, the kill command sends the signal to all processes that have a process group ID equal to the absolute value of the PID. -l Lists all signal names supported by the implementation