What is elegant way to do configuration on server app

Chris Angelico rosuav at gmail.com
Fri Mar 27 09:12:22 EDT 2015


On Fri, Mar 27, 2015 at 7:47 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Grant Edwards <invalid at invalid.invalid>:
>
>> That sounds rather Windowsesque. The more-or-less standard way to do
>> handle the situation on Unix is to reread the config file when you get
>> a SIGHUP.
>
> That, indeed, is the classic Unix way. However, Linux has now moved to
> systemd:
>
>        Note however that reloading a daemon by sending a signal (as with
>        the example line above) is usually not a good choice, because
>        this is an asynchronous operation and hence not suitable to order
>        reloads of multiple services against each other. It is strongly
>        recommended to set ExecReload= to a command that not only
>        triggers a configuration reload of the daemon, but also
>        synchronously waits for it to complete.

The number of cases where this matters is fairly low. Doing the reload
asynchronously is generally sufficient. And even if you have something
that waits for the reload to finish, you'll usually fire-and-forget
that command anyway.

For maximum portability, most programs are going to want to continue
to respond to SIGHUP, even if they do a systemd-triggered reload some
other way.

ChrisA



More information about the Python-list mailing list