- or download this
#!/usr/bin/perl
...
while(sleep(1)) {
}
- or download this
$ perl test.pl
My pid is: 3188
...
$ kill -SIGUSR1 3188
got signal.
---> script is terminated
- or download this
#include <stdio.h>
#include <stdlib.h>
...
void usr1handler(int signal) {
printf("Got a signal: %d\n", signal);
}
- or download this
$ ./test
My pid is: 3188
...
$ kill -SIGUSR1 3318
Got a signal called: 10
... it never exits