About UNIX shell trap, any relative function in Python ?

Discussion in 'Python' started by moonhkt, Dec 15, 2012.

  1. moonhkt

    moonhkt Guest

    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 ?

    moonhkt
     
    moonhkt, Dec 15, 2012
    #1
    1. Advertisements

  2. On Sun, Dec 16, 2012 at 2:34 AM, moonhkt <> 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
     
    Chris Angelico, Dec 15, 2012
    #2
    1. Advertisements

  3. Chris Angelico, Dec 15, 2012
    #3
  4. moonhkt

    moonhkt Guest

    On 12月16æ—¥, 上åˆ12時05分, Chris Angelico <> wrote:
    > On Sun, Dec 16, 2012 at 3:04 AM, Chris Angelico <> wrote:
    > > On Sun, Dec 16, 2012 at 2:34 AM, moonhkt <> wrote:

    >
    > >> Hi All

    >
    > >> Machine : AIX 5.3
    > >> Python : 2.6.2

    >
    > > Yep! Check out the 'signal' module:

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

    >
    > Or, since you're working with 2.6.2:
    >
    > http://docs.python.org/2.6/library/signal.html
    >
    > ChrisA


    Thank. will try.
     
    moonhkt, Dec 15, 2012
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    6,923
    Jonathan Bromley
    Feb 18, 2005
  2. Replies:
    4
    Views:
    2,091
    Terry Hancock
    Apr 23, 2005
  3. Sebastjan Trepca

    How to create a unix shell account with Python?

    Sebastjan Trepca, Feb 5, 2006, in forum: Python
    Replies:
    2
    Views:
    399
    Sebastjan Trepca
    Feb 6, 2006
  4. Deniz Dogan

    UNIX shell in Python?

    Deniz Dogan, Feb 9, 2007, in forum: Python
    Replies:
    3
    Views:
    478
    Deniz Dogan
    Feb 9, 2007
  5. Ramon F Herrera
    Replies:
    2
    Views:
    695
    Nigel Wade
    Oct 29, 2007
  6. Gerardo Herzig
    Replies:
    1
    Views:
    1,427
    Philipp Pagel
    Feb 27, 2008
  7. Weng Tianxiang
    Replies:
    7
    Views:
    1,618
    Paul Uiterlinden
    Sep 11, 2009
  8. edwithad

    Bash shell to Python shell?

    edwithad, Sep 28, 2009, in forum: Python
    Replies:
    4
    Views:
    2,140
Loading...