Call shell script from python script, exit without waiting for shell script to finish

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • telduivel
    New Member
    • Oct 2007
    • 2

    Call shell script from python script, exit without waiting for shell script to finish

    Can someone please help me with this:

    I have a python script, that at some point calls a linux bash script (.sh). Starting the shell script is the last thing my python script needs to do, so I would like for the python script to exit once the call has been made, without waiting for the shell script to finish.

    My question is:

    how do I call a shell script from a python script?

    and how do I do that such that control is tranferred to the shell script and the python script does not wait for the shell script to exit, but clean itself up?
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by telduivel
    Can someone please help me with this:

    I have a python script, that at some point calls a linux bash script (.sh). Starting the shell script is the last thing my python script needs to do, so I would like for the python script to exit once the call has been made, without waiting for the shell script to finish.

    My question is:

    how do I call a shell script from a python script?

    and how do I do that such that control is tranferred to the shell script and the python script does not wait for the shell script to exit, but clean itself up?
    See spawn* and P_NOWAIT in 14.1.5 Process Management of the 2.5 documentation.

    Comment

    • telduivel
      New Member
      • Oct 2007
      • 2

      #3
      Thanks. That's what I was looking for.

      Comment

      • bartonc
        Recognized Expert Expert
        • Sep 2006
        • 6478

        #4
        Originally posted by telduivel
        Thanks. That's what I was looking for.
        You are welcome. I live to hear those words!

        Keep posting,
        Barton

        Comment

        Working...