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


Groups > comp.lang.python > #77790

Re: Example of python service running under systemd?

Date 2014-09-11 20:03 -0600
From Michael Torrie <torriem@gmail.com>
Subject Re: Example of python service running under systemd?
References <FE4C3550-8958-4F72-8AFE-62AA7248D6AF@gmail.com> <CAMw+j7+LQL_+77ejCFVSqWap7Rk9gS_Wu5d3y0gT1UpB8hiZAA@mail.gmail.com> <6B97B7A5-0816-401E-9BDD-A23FFC646985@gmail.com> <20140911212921.GB26465@arxnet.hu>
Newsgroups comp.lang.python
Message-ID <mailman.13953.1410488545.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 09/11/2014 03:29 PM, Ervin Hegedüs wrote:
>> It basically creates two threads, one which does some local processing and control, the other which periodically does reporting via udp packets. I use the dual threads because they both work with a shared serial port at times, so I have to synchronize access through that.
>>
>> What I want is to have this startup, after my board has it’s networking layer up and running (and hopefully a valid ip address by then), and to just keep running forever
> 
> may be you think about the fork(), eg:

No, you you don't need to do this.  Systemd can handle all of that for
you.  Read up on the docs on creating systemd services.  Here's a little
blog post that has some good examples, both a non-daemonizing service
and a daemonizing service:

http://patrakov.blogspot.com/2011/01/writing-systemd-service-files.html

Any executable file can be turned into a daemon service with systemd
(whether or not it forks itself into the background).  Thus any python
script can easily be run from systemd.

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


Thread

Re: Example of python service running under systemd? Michael Torrie <torriem@gmail.com> - 2014-09-11 20:03 -0600

csiph-web