View Single Post
Posts: 3,319 | Thanked: 5,610 times | Joined on Aug 2008 @ Finland
#573
Another alternative is to use signals:

signal.signal(signal.SIGTERM, handlerfunc)

(not sure it's sigterm but there should be something along those lines)
http://docs.python.org/library/signal.html