[Grok-dev] Execute function when server is shut down

Jan-Wijbrand Kolman janwijbrand at gmail.com
Mon Jan 10 03:37:08 EST 2011


On 12/23/10 17:59 PM, Hector Blanco wrote:
> Hello everyone...
>
> I'd like to know if there's a way to execute some commands (closing
> database connection, finish transaction...) when the grok server is
> shutdown.
>
> I tried to add a __del__ method to my "Server(grok.Application,
> grok.Container)" but it doesn't seem to work.

I think if the __del__() were to be called in a way that is useful to 
your case, it would've been called when the instance is cleared from the 
database.

I searched for an event that might be fired upon shutdown, but there 
seems not to be one. It actually make me wonder how shutdown actually 
works. This needs a bit of investigation...

regards, jw



More information about the Grok-dev mailing list