Python Forum
Python Daemons & Configs & Communication
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Daemons & Configs & Communication
#1
Hello. Not fully sure if this is the right thread section. I'm new to this forum and a beginner. I have a hand full of minor questions, but I didn't want to split it across multiple threads.

What makes a daemon a daemon I understand that they're background processes, but is there really a correct way to make one? Or is a 'while True:' script all it takes?

YAML vs ConfigObj? Pros and Cons?

What are some modern options to comunicating with daemons? I heard of doing it through config. Is there a correct way of doing it or should I just have the daemon check the config file repeatedly with a loop and clear it each time?
Reply
#2
If it needs to run all the time, then a while True loop is good enough.
When it comes to config, I find the best types of config are the ones that are easy for real people to understand, instead of ones that are made for computers.  So yaml is acceptable, but not really ideal.  toml is currently my favorite format for this, as it supports nested groupings, without being strict about data types.

When it comes to communicating with a long running process, the main question you should ask yourself is what you want it to do if it restarts.  Should your changes be forgotten, or should whatever change you make be permanent?  Following the direction a major package went is a fine choice.  Web servers (apache, lighttpd, nginx, etc) all pretty much operate only off of config files, and if you want a change to the config to take effect, you need to restart the daemon.  Re-parsing a config file while running seems fishy to me.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Good Example for bi-directional Communication between Python and Windows (C#) raybowman 0 1,616 Nov-14-2020, 06:44 PM
Last Post: raybowman
  packet radio communication EmpireAndrew 1 2,204 Nov-01-2019, 06:35 PM
Last Post: micseydel
  WiFi communication Milad 2 2,494 Sep-07-2019, 11:53 AM
Last Post: ndc85430
  Simple inter-process communication: Switching from Perl to Python Pappy 1 2,912 May-10-2019, 12:29 AM
Last Post: Pappy
  Serial communication with raspberry pi 3B and Xbee kj7 0 2,189 Mar-25-2019, 03:39 AM
Last Post: kj7
  Serial Communication Error AlphyOuseph 1 3,555 Feb-07-2019, 07:16 AM
Last Post: DeaD_EyE
  pi3 serial communication tony1812 0 2,173 Sep-23-2018, 10:29 PM
Last Post: tony1812
  python-osc communication fauveboy 10 10,248 Jul-23-2018, 07:49 PM
Last Post: buran
  Serial communication with a board Bokka 2 5,373 Dec-07-2017, 07:34 AM
Last Post: Bokka
  code pattern for process communication Skaperen 12 8,558 Oct-08-2017, 03:14 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020