[Zope-Coders] Signal handling

Chris McDonough chrism@zope.com
14 Jun 2002 17:05:42 -0400


To be more specific, restart-on-HUP no longer works.  I'm fully in
posix-land at the moment and it should be fixed any year now. ;-)

On Fri, 2002-06-14 at 16:38, Chris McDonough wrote:
> Whoops, the only problem is that it no longer works. <wink> ;-)
> 
> I'll take a look.
> 
> - C
> 
> 
> On Fri, 2002-06-14 at 12:02, Brian Lloyd wrote:
> > > I have some products that have their own log files, and it would 
> > > be nice to 
> > > reopen those on a USR2 too. 
> > > 
> > > Any objections to the patch in http://collector.zope.org/Zope/430 ?
> > 
> > It seems like it would be good for this to be a more 
> > generalized facility, rather than adding more funny 
> > magic globals.
> > 
> > So I went ahead and did it :)
> > 
> > Chris, I refactored it so that the sig handling code 
> > that was in z2.py is now encapsulated in a singleton 
> > in a new module: SignalHandler.py.
> > 
> > The way it works now, the "standard" signal handlers 
> > that were in z2 are guaranteed to run, but users can 
> > now use the registerHander method to add handlers for 
> > given signals. For example:
> > 
> > from SignalHandler import SignalHandler
> > import signal
> > 
> > def mySigUsr2Handler():
> >   print 'hi, Im the SIGUSR2 handler!'
> > 
> > SignalHandler.registerHandler(signal.SIGUSR2, mySigUsr2Handler)
> > 
> > 
> > The only caveat is that for now you are restricted to 
> > SIGINT, SIGTERM, SIGUSR2 and SIGHUP. That's because 
> > of the way that signal pass-through is hooked up to 
> > zdaemon. The SignalHandler singleton can deal with 
> > any kind of signal, so if we ever care to figure this 
> > out we'll just need to revisit the way that zdaemon is 
> > notified of pass-through signals.
> > 
> > 
> > 
> > Brian Lloyd        brian@zope.com
> > V.P. Engineering   540.361.1716       
> > Zope Corporation   http://www.zope.com
> > 
> > 
> > 
> > 
> > _______________________________________________
> > Zope-Coders mailing list
> > Zope-Coders@zope.org
> > http://lists.zope.org/mailman/listinfo/zope-coders
> 
> 
> 
> 
> _______________________________________________
> Zope-Coders mailing list
> Zope-Coders@zope.org
> http://lists.zope.org/mailman/listinfo/zope-coders