What is elegant way to do configuration on server app

Marko Rauhamaa marko at pacujo.net
Fri Mar 27 04:47:57 EDT 2015


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:

   ExecReload=

       Commands to execute to trigger a configuration reload in the
       service. This argument takes multiple command lines, following
       the same scheme as described for ExecStart= above. Use of this
       setting is optional. Specifier and environment variable
       substitution is supported here following the same scheme as for
       ExecStart=.

       One additional, special environment variable is set: if known,
       $MAINPID is set to the main process of the daemon, and may be
       used for command lines like the following:

       /bin/kill -HUP $MAINPID

       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.

   <URL: http://www.freedesktop.org/software/systemd/ma
   n/systemd.service.html>


Marko



More information about the Python-list mailing list