What is elegant way to do configuration on server app
Grant Edwards
invalid at invalid.invalid
Fri Mar 27 12:28:56 EDT 2015
On 2015-03-27, Jerry OELoo <oyljerry at gmail.com> wrote:
>>> Make a part of your event loop (assuming your server runs an event
>>> loop) that wakes up every N seconds (e.g. every 60 seconds) and
>>> checkes the file's modification timestamp again; if it's newer, record
>>> that value for future comparisons, then re-read the file for its
>>> values.
>>
>> 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.
>
> Why use SIGHUP,
It's just tradition. Some other seldom-used signal could have been
chosen, but way back when somebody chose SIGHUP, and other people
followed suit.
> Does it has something to do with configure file modification?
Not intrinsically. It's just a convention in the Unix world that
sending SIGHUP to a daemon will cause it to re-read its configuration
files.
I presume that automagically reading them any time they changed was
both too much hassle and possibly dangerous: if a file is being
edited, it might get saved in intermediate (broken) states during the
editing session.
--
Grant Edwards grant.b.edwards Yow! An air of FRENCH FRIES
at permeates my nostrils!!
gmail.com
More information about the Python-list
mailing list