Re: Shutdown hook

2008-10-09 Thread Mr.Rech
Not sure about this (never tried), but Python Library Reference says: Note: the functions registered via this module are not called when the program is killed by a signal, when a Python fatal internal error is detected, or when os._exit() is called. Since Ctrl+C sends a SIGINT to your server

Re: Shutdown hook

2008-10-09 Thread Jonathan Vanasco
after reading that i thought catch signal? and then yahoo search said import signal and someone seems to have worked on the same issue-- http://stevemorin.blogspot.com/2005/11/python-shutdown-hook-method-update.html from what i've read, you probably want a couple of ways to catch the exit

Re: Shutdown hook

2008-10-09 Thread Wichert Akkerman
Previously Mr.Rech wrote: Not sure about this (never tried), but Python Library Reference says: Note: the functions registered via this module are not called when the program is killed by a signal, when a Python fatal internal error is detected, or when os._exit() is called. Since

Shutdown hook

2008-10-08 Thread Phil Fazio
Hi all, I was wondering if there were a way to run methods or execute code on server shutdown (Ctrl+C, or otherwise). I'd like to close a Berkeley DB environment I'm running so as to avoid a potential nasty bug -- I tried adding code to the __del__() method of app_globals.py, but it doesn't

Re: Shutdown hook

2008-10-08 Thread Philip Jenvey
On Oct 8, 2008, at 3:40 PM, Phil Fazio wrote: I was wondering if there were a way to run methods or execute code on server shutdown (Ctrl+C, or otherwise). I'd like to close a Berkeley DB environment I'm running so as to avoid a potential nasty bug -- I tried adding code to the __del__()

Re: Shutdown hook

2008-10-08 Thread Phil Fazio
I appreciate your quick response. However, I don't think I'm doing it right... I tried putting the following code in my app_globals.Globals.__init__() method: import atexit import fooapp.models.database as db atexit.register(db.close_environment) where my close_environment() method