hotshot has asked for the wisdom of the Perl Monks concerning the following question:

hello guys !

A question. I have a perl script (a shell for our product), and I have a situation that I need from one running copy of the script to kill another copy of the shell that runs by another user, BUT I need also to send the shell to be killed, a message (so he'll no what happened). sending SIGKILL from the murderer to the victim (using perl kill) will easly solve me the problem of killing but no message will be sent to the user, since I have a already a signal handler for SIGINT that does something else.
I tried using SIGPIPE, that did the trick (I wrote a signal handler for it), but sometimes in a random manner the signal handler is preformed twice and it seems to be connected to the SIGPIPE i send.
Anyone has a suggetion why this happens, or can offer me a better solution?

Hotshot

Replies are listed 'Best First'.
Re: signal pipe
by kjherron (Pilgrim) on Jan 03, 2002 at 23:00 UTC
    Depending on what the victim process is doing, it could receive a sigpipe for some other, perfectly legitimate reason. It's probably not a good signal to overload in this manner.

    SIGTERM is the standard signal to use for signalling a process to terminate. If you can't use that for some reason, perhaps you can use SIGUSR1 or SIGUSR2.

Re: signal pipe
by derby (Abbot) on Jan 03, 2002 at 22:55 UTC
    Hotshot,

    Sounds like an ideal place for SIGUSR1 (30) or SIGUSR2 (31) if your system supports them.

    -derby