Python program as daemon?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Johny

    Python program as daemon?

    Is it possible to run a Python program as daemon?
    Thanks
  • Sebastian \lunar\ Wiesner

    #2
    Re: Python program as daemon?

    Johny <python@hope.cz >:
    Is it possible to run a Python program as daemon?
    You can write daemons in basically any language out there.

    --
    Freedom is always the freedom of dissenters.
    (Rosa Luxemburg)

    Comment

    • Brett g Porter

      #3
      Re: Python program as daemon?

      Johny wrote:
      Is it possible to run a Python program as daemon?
      Sure -- see http://code.activestate.com/recipes/66012/ for an example
      (and some useful stuff in the comments.)

      Comment

      • sturlamolden

        #4
        Re: Python program as daemon?

        On Jul 25, 8:37 pm, Johny <pyt...@hope.cz wrote:
        Is it possible to run a Python program as daemon?
        Thanks
        Here is an example on how to run a Python script as a Unix daemon:



        Basically it forks twice and redirects open file descriptors to /dev/
        null.

        On Windows, 'daemons' are called services. You can write Windows
        services in Python using the Pywin32 extension. See Mark Hammond's
        book for an explanation.

        Comment

        • Lawrence D'Oliveiro

          #5
          Re: Python program as daemon?

          In message
          <13866da4-01ed-4330-8297-8bdecce1393a@x3 5g2000hsb.googl egroups.com>,
          sturlamolden wrote:
          Basically it forks twice ...
          What's the advantage of forking twice over forking once and calling setsid?

          Comment

          • Diez B. Roggisch

            #6
            Re: Python program as daemon?

            Lawrence D'Oliveiro schrieb:
            In message
            <13866da4-01ed-4330-8297-8bdecce1393a@x3 5g2000hsb.googl egroups.com>,
            sturlamolden wrote:
            >
            >Basically it forks twice ...
            >
            What's the advantage of forking twice over forking once and calling setsid?


            See the comments.

            Diez

            Comment

            • James Harris

              #7
              Re: Python program as daemon?

              On 25 Jul, 20:05, sturlamolden <sturlamol...@y ahoo.nowrote:
              On Jul 25, 8:37 pm, Johny <pyt...@hope.cz wrote:
              >
              Is it possible to run a Python program as daemon?
              Thanks
              >
              Here is an example on how to run a Python script as a Unix daemon:
              >
              http://svn.plone.org/svn/collective/...a/daemon/daemo...
              >
              Basically it forks twice and redirects open file descriptors to /dev/
              null.
              >
              On Windows, 'daemons' are called services. You can write Windows
              services in Python using the Pywin32 extension. See Mark Hammond's
              book for an explanation.
              Also, on Windows, you can get good results using srvany



              I've set this up to run Pyhton for a couple of scripts.

              Comment

              Working...