I've read somewhere that on unix you can trap signals (SIGTERM for you) with the help of 'termios' module. Look for this in FAQ, you'll find it. Lexy