About UNIX shell trap, any relative function in Python ?

Chris Angelico rosuav at gmail.com
Sat Dec 15 11:04:57 EST 2012


On Sun, Dec 16, 2012 at 2:34 AM, moonhkt <moonhkt at gmail.com> wrote:
>
> Hi All
>
> Machine : AIX 5.3
> Python : 2.6.2
>
> In UNIX have, trap to run defined CLEAN_UP function. When  HUP INT
> KILL STOP TERM will run CLEAN_UP function.
>
> trap 'echo "\n\nProcessing Clean up"; CLEAN_UP; exit' HUP INT KILL
> STOP TERM
>
> Any relative function in Python ?

Yep! Check out the 'signal' module:

http://docs.python.org/3.3/library/signal.html

ChrisA



More information about the Python-list mailing list