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


Groups > comp.lang.python > #76812

Re: Halfway point between interactive and daemon?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Marko Rauhamaa <marko@pacujo.net>
Newsgroups comp.lang.python
Subject Re: Halfway point between interactive and daemon?
Date Fri, 22 Aug 2014 22:49:01 +0300
Organization A noiseless patient Spider
Lines 20
Message-ID <87wqa09ufm.fsf@elektro.pacujo.net> (permalink)
References <CAKUKWzmnnrpm-9SVNAFu3G9vYf2w0ewAhnGeOge8B2NsDujamQ@mail.gmail.com> <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>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info mx05.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="669"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/koH33vEoSpN4a8KAfjZk7"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
Cancel-Lock sha1:dNnIAPedO++IOfe5nMUl9mjw1QQ= sha1:oa0DbsaIIhVHzsSWcwIegz0UqNI=
Xref csiph.com comp.lang.python:76812

Show key headers only | 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