On Fri, Feb 6, 2009 at 4:06 AM, dave selby <dave6...@googlemail.com> wrote:

> import sys, threading, time, os.path, urllib, time, signal, ConfigParser, 
> logger
> ....
>
> def main():
>
>    while True: # sleep to keep daemons alive :)
>        time.sleep(60 * 60 * 24)
>
>
> def signal_hup(signum, frame):
>    """
>    SIGHUP, unlike all other daemons SIGHUP causes this daemon to exit killing
>    all its daemon threads. This is a workaround. Because 'kmotion_ptzd' is
>    threaded the only way to get the threads to reliably reload their config
>    is to kill and restart else they languish in a sleep state for ? secs.
>
>    args    : discarded
>    excepts :
>    return  : none
>    """
>
>    print 'sighup :)'
>    #logger.log('signal SIGHUP detected, shutting down due to
> threading', 'CRIT')
>    #sys.exit()
>
> ...
> main()

Don't you have to register your handler with something like
signal.signal(signal.SIGHUP, signal_hup)
?

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to