Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76812

Re: Halfway point between interactive and daemon?

From Marko Rauhamaa <marko@pacujo.net>
Newsgroups comp.lang.python
Subject Re: Halfway point between interactive and daemon?
Date 2014-08-22 22:49 +0300
Organization A noiseless patient Spider
Message-ID <87wqa09ufm.fsf@elektro.pacujo.net> (permalink)
References (1 earlier) <CAPTjJmrO7fER7Wjgo6qNO9qHNJgkJ7Y3BFWBf1L=t-bOv4JV7w@mail.gmail.com> <53F634E5.4020206@m4x.org> <mailman.13263.1408667169.18130.python-list@python.org> <0f0ef37d-7d09-483f-8f9b-c63c444f1ea7@googlegroups.com> <mailman.13302.1408735687.18130.python-list@python.org>

Show all headers | View raw


Travis Griggs <travisgriggs@gmail.com>:

> nohup python3 myMain.py 2>&1 > /var/log/mylog.log &

I don't recommend this (ubiquitous) technique. You should keep your
daemon in the foreground until it has reserved and initialized all the
resources it needs and daemonize only then. That way the caller does not
have to guess when the service is really available.

The proper daemonization procedure is here:

  <URL: http://code.activestate.com/recipes/66012-fork-a-dae
  mon-process-on-unix/>

Now, with the new systemd standard, there is a way for you to inform the
system when a service is up even after backgrounding. I have no personal
experience with that technique.


Marko

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Python vs C++ Chris Angelico <rosuav@gmail.com> - 2014-08-22 10:26 +1000
  Re: Python vs C++ CHIN Dihedral <dihedral88888@gmail.com> - 2014-08-22 12:00 -0700
    Halfway point between interactive and daemon? Travis Griggs <travisgriggs@gmail.com> - 2014-08-22 12:27 -0700
      Re: Halfway point between interactive and daemon? Marko Rauhamaa <marko@pacujo.net> - 2014-08-22 22:49 +0300
    Re: Halfway point between interactive and daemon? Chris Angelico <rosuav@gmail.com> - 2014-08-23 06:32 +1000

csiph-web