How to implement a server application that can reload configuration without restart

I have a server application in Python which is configured via config file. Now, I'd like to be able to make the server reload that configuration without restarting. That is, I want to run a command which somehow tells the running server process that it should reload the config (or rather do some generic action, doesn't need to be specific to configuration reloading). How is this usually implemented? I think it is a pretty common functionality but when searching, I only find questions about how to make a specific application XY reload but nothing on how to best implement this in my own application. One option would be to monitor the config file for changes and automatically reload, but I would prefer to trigger the reloading manually. I'm on Linux by the way and the solution doesn't need to be portable.

Mar 12, 2025 - 10:18
 0
How to implement a server application that can reload configuration without restart

I have a server application in Python which is configured via config file. Now, I'd like to be able to make the server reload that configuration without restarting. That is, I want to run a command which somehow tells the running server process that it should reload the config (or rather do some generic action, doesn't need to be specific to configuration reloading).

How is this usually implemented? I think it is a pretty common functionality but when searching, I only find questions about how to make a specific application XY reload but nothing on how to best implement this in my own application.

One option would be to monitor the config file for changes and automatically reload, but I would prefer to trigger the reloading manually.

I'm on Linux by the way and the solution doesn't need to be portable.