Halfway point between interactive and daemon?

Marko Rauhamaa marko at pacujo.net
Fri Aug 22 15:49:01 EDT 2014


Travis Griggs <travisgriggs at 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



More information about the Python-list mailing list