Kill and Signals

From: Isidro Vila Verde (jvv_at_serprest.pt)
Date: 11/16/03


Date: 16 Nov 2003 06:34:39 -0800

Greetings,

I need to handle signals to close some excel applications that my
script open, when the script is killed by another process.

My script is a little bit complex, but I wrote just two very small
scripts to test the kill and signal.

The scripts signal.pl is this one:
        map {$SIG{$_} = sub {my $n = shift; print "n=$n\n"}} keys %SIG;
        #just in case
        $SIG{INT} = sub {my $n = shift; print "n=$n\n"};
        print "pid = $$\n";
        sleep 1 while(1)

And the second one (kill.pl) is just the following line:
        kill ($ARGV[0] => $ARGV[1]);

What I call the second like this:
>perl kill.pl INT pid_returned_from_first_script

I expected the signal to be handled by fisrt script, but no matter
what signal I sent, the first script never receives the signal. It
just was killed without any signal handling.

Does anyone know what I am doing wrong here?

Isidro



Relevant Pages

  • Re: OpenVMS 8.1 ships
    ... Perl has about ... only modifications to one DCL script and one Perl script ... signals with a home-grown implementation based on the undocumented ... CRTL bug on 7.x systems that precludes the ability to call ...
    (comp.os.vms)
  • How to propagate signal down to child? trap erratic; wait not waiting
    ... I am having trouble propagating signals down to a child. ... I have a script s.sh that calls a program p ... trap killchild SIGTERM ...
    (comp.unix.shell)
  • Re: logrotate error
    ... logrotate -bash-3.00# logrotate -f logrotate.conf error: ... running script with arg /var/log/servicelog: " /bin/killall -s HUP ntpd; ... If you have not used strace before, its output is voluminous enouhg to bring ... to see what they do when they receive signals. ...
    (comp.os.linux.setup)
  • Re: Ctrl-C in script causing started process to terminate
    ... I ran the script and waited a bit for my process to finish its ... SIGINT and 2 of the child processes just die at the same time. ... disposition for signals handled in the parent is set to SIG_DFL. ... pressing C-C) are sent to the foreground process group, ...
    (comp.unix.programmer)
  • Re: Disabling/Enabling Keys in BASH Script
    ... > and when you use it, at any point of executing the script. ... the terminal sends a SIGINT ... signal to the foreground process group of processes (the shell ... You can tell the terminal to stop sending signals upon pressing ...
    (comp.unix.shell)