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


Groups > comp.lang.python > #76811

Halfway point between interactive and daemon?

Subject Halfway point between interactive and daemon?
From Travis Griggs <travisgriggs@gmail.com>
Date 2014-08-22 12:27 -0700
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>
Newsgroups comp.lang.python
Message-ID <mailman.13302.1408735687.18130.python-list@python.org> (permalink)

Show all headers | View raw


I have a python3 program that performs a long running service on a semi embedded linux device. I've been in the prototyping stage.  I just run it from the command line and use print() statements to let me know the thing is making acceptable process.

At some point, I need to properly daemonize it. Write an init script, find a logging framework/module, batton all the hatches down, so to speak.

I’m curious if there’s a technique one could use to get half way there. Basically, with minimal modifications, I’d like to get it running at startup. So I can put a line like this in rc.local

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

Then I can “check” on it when I need to with a tail -f /var/log/mylog.log. But then I have the problem of managing the log size. And also I either have to wait for stdout to flush, or insert sys.stdout.flush() after any of my print()’s.

I haven’t done a lot of these daemon processes (and this is my first with python), so I was curious what those with experience do here.

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