[Zope] how do I manage a graceful shutdown?

Toby Dickenson tdickenson@geminidataloggers.com
Fri, 21 Feb 2003 09:57:04 +0000


On Friday 21 February 2003 9:31 am, Jamie Heilman wrote:

> Its been my opinion for some time that Zope could benefit from an
> internal "init(8)-style" API that products could hook into.

Aha! you want to be *notified* of shutdown, rather than participate in a 
gradual, *staged* shutdown.  Yes,  Lifetime.py is the wrong area.

> inspection it looks like Lifetime.py is designed to only be concerned
> with the lifetime of asyncore, and not of Zope & the ZODB in general.

> Thus, in short Tim, no, there doesn't appear to be a simple solution
> to your problem, unless your "products" happen to be socket handlers

Yes

> or the atexit module's semantics don't bother you.

What problems could there be in atexit semantics?

The atexit documentation does say:
| the functions registered via this module are not called when the
| program is killed by a signal
Note that this does not apply if Zope is closed using a SIGTERM or SIGINT. 
Zope will catch those signals, close gracefully, and call atexit-registered 
functions.

-- 
Toby Dickenson
http://www.geminidataloggers.com/people/tdickenson