From ed36c26598892c60c6d2c9a096f536cc1f4705cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 6 May 2018 12:11:51 +0200 Subject: Also handle SIGHUP to reload the configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because that’s what is typically done on other deamons, and we don’t want to suprise users. --- CHANGELOG.rst | 2 ++ doc/biboumi.1.rst | 8 ++++---- src/main.cpp | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 63b594f..5f65bfc 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,8 @@ Version 9.0 =========== +- SIGHUP is now caught and reloads the configuration like SIGUSR1 and 2. + Version 8.0 - 2018-05-02 ======================== diff --git a/doc/biboumi.1.rst b/doc/biboumi.1.rst index 03e8a36..5d6facc 100644 --- a/doc/biboumi.1.rst +++ b/doc/biboumi.1.rst @@ -42,10 +42,10 @@ variables, with the name all in upper case and prefixed with "BIBOUMI_". For example, if the environment contains “BIBOUMI_PASSWORD=blah", this will override the value of the “password” option in the configuration file. -Sending SIGUSR1 or SIGUSR2 (see kill(1)) to the process will force it to -re-read the configuration and make it close and re-open the log files. You -can use this to change any configuration option at runtime, or do a log -rotation. +Sending SIGUSR1, SIGUSR2 or SIGHUP (see kill(1)) to the process will force +it to re-read the configuration and make it close and re-open the log +files. You can use this to change any configuration option at runtime, or +do a log rotation. Here is a description of every possible option: diff --git a/src/main.cpp b/src/main.cpp index 59fda4e..09adc5c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -103,6 +103,7 @@ int main(int ac, char** av) sigaddset(&mask, SIGTERM); sigaddset(&mask, SIGUSR1); sigaddset(&mask, SIGUSR2); + sigaddset(&mask, SIGHUP); sigprocmask(SIG_BLOCK, &mask, nullptr); // Install the signals used to exit the process cleanly, or reload the @@ -124,6 +125,7 @@ int main(int ac, char** av) on_sigusr.sa_flags = 0; sigaction(SIGUSR1, &on_sigusr, nullptr); sigaction(SIGUSR2, &on_sigusr, nullptr); + sigaction(SIGHUP, &on_sigusr, nullptr); auto p = std::make_shared(); -- cgit v1.2.3