daemonizing python

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jubei
    New Member
    • Dec 2006
    • 8

    #1

    daemonizing python

    So I'm trying to daemonize a python script , I've got the following already

    Code:
     if os.fork():
       sys.exit()
    i'm not sure how to handle closing and then reopening stdin,stdout,st derr, or if its even needed in python
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    Originally posted by jubei
    So I'm trying to daemonize a python script , I've got the following already

    Code:
     if os.fork():
       sys.exit()
    i'm not sure how to handle closing and then reopening stdin,stdout,st derr, or if its even needed in python
    Hi jubei,
    I'm not entirely sure what you are trying to accomplish. If you could elaborate on your problem and perhaps include a little more code, as well as explain what, exactly you are trying to do, I'm sure the forum will be a much greater help.

    Comment

    • dshimer
      Recognized Expert New Member
      • Dec 2006
      • 136

      #3
      I'll be the first to admit that I have no idea where you are headed, and it's been almost a decade since I was on unix daily. That said, a great place to look for obscure, sometimes advanced, always helpful example code is Python Cookbook.
      for example
      Title: Creating a daemon the Python way
      Makes mention of redirecting to /dev/null in regard to your question.

      Comment

      • Motoma
        Recognized Expert Specialist
        • Jan 2007
        • 3236

        #4
        Originally posted by dshimer
        I'll be the first to admit that I have no idea where you are headed, and it's been almost a decade since I was on unix daily. That said, a great place to look for obscure, sometimes advanced, always helpful example code is Python Cookbook.
        for example
        Title: Creating a daemon the Python way
        Makes mention of redirecting to /dev/null in regard to your question.
        Great links dshimer, thanks!

        Comment

        • jubei
          New Member
          • Dec 2006
          • 8

          #5
          dshimer, Thanks for the link, thats exactly what i was looking for

          Comment

          Working...