Python program as daemon?

Discussion in 'Python' started by Johny, Jul 25, 2008.

  1. Johny

    Johny Guest

    Is it possible to run a Python program as daemon?
    Thanks
    Johny, Jul 25, 2008
    #1
    1. Advertising

  2. Johny <>:

    > 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)
    Sebastian \lunar\ Wiesner, Jul 25, 2008
    #2
    1. Advertising

  3. Brett g Porter, Jul 25, 2008
    #3
  4. Johny

    sturlamolden Guest

    On Jul 25, 8:37 pm, Johny <> 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/bda.daemon/trunk/bda/daemon/daemon.py

    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.
    sturlamolden, Jul 25, 2008
    #4
  5. In message
    <>,
    sturlamolden wrote:

    > Basically it forks twice ...


    What's the advantage of forking twice over forking once and calling setsid?
    Lawrence D'Oliveiro, Jul 28, 2008
    #5
  6. Lawrence D'Oliveiro schrieb:
    > In message
    > <>,
    > sturlamolden wrote:
    >
    >> Basically it forks twice ...

    >
    > What's the advantage of forking twice over forking once and calling setsid?


    http://code.activestate.com/recipes/278731/

    See the comments.

    Diez
    Diez B. Roggisch, Jul 28, 2008
    #6
  7. Johny

    James Harris Guest

    On 25 Jul, 20:05, sturlamolden <> wrote:
    > On Jul 25, 8:37 pm, Johny <> 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/bda.daemon/trunk/bda/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

    http://support.microsoft.com/kb/137890

    I've set this up to run Pyhton for a couple of scripts.
    James Harris, Jul 28, 2008
    #7
    1. Advertising

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. Jean-Paul Calderone
    Replies:
    0
    Views:
    454
    Jean-Paul Calderone
    Mar 20, 2009
  2. Floris Bruynooghe
    Replies:
    1
    Views:
    449
    Floris Bruynooghe
    Mar 24, 2009
  3. §ä´M¦Û¤vªº¤@¤ù¤Ñ

    Daemon call python program

    §ä´M¦Û¤vªº¤@¤ù¤Ñ, Oct 12, 2009, in forum: Python
    Replies:
    0
    Views:
    283
    §ä´M¦Û¤vªº¤@¤ù¤Ñ
    Oct 12, 2009
  4. §ä´M¦Û¤vªº¤@¤ù¤Ñ

    Re: Daemon call python program

    §ä´M¦Û¤vªº¤@¤ù¤Ñ, Oct 12, 2009, in forum: Python
    Replies:
    1
    Views:
    422
    Jorgen Grahn
    Oct 12, 2009
  5. Daemon Win32::Daemon;

    , Sep 7, 2006, in forum: Perl Misc
    Replies:
    0
    Views:
    250
Loading...

Share This Page