Example of python service running under systemd?
torriem at gmail.com
Fri Sep 12 04:03:54 CEST 2014
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:
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.
More information about the Python-list