Notifications when process is killed

AndDM anddimario at gmail.com
Tue Aug 2 03:30:52 EDT 2011


On Aug 1, 5:39 pm, Andrea Di Mario <anddima... at gmail.com> wrote:
> Thanks Thomas, it is what i'm looking for.
>
> Regards
>
> --
> Andrea Di Mario

Hi, i've a little problem, here the code that i use:

        def receive_signal(signum, stack):
                logging.info('Received: %s' % signum)
                reactor.stop()
        signal.signal(signal.SIGTERM, receive_signal)
        signal.signal(signal.SIGHUP, receive_signal)
        signal.signal(signal.SIGINT, receive_signal)

The function works for SIGHUP and SIGINT, but it doesn't work for
SIGTERM. I've tried with simple killall and with -15 option.
Have you some ideas?

Thanks, regards.



More information about the Python-list mailing list