guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/04: services: syslog: Add a reload action.


From: guix-commits
Subject: 02/04: services: syslog: Add a reload action.
Date: Fri, 21 Apr 2023 09:36:04 -0400 (EDT)

apteryx pushed a commit to branch master
in repository guix.

commit 2c67e98b37e5b73c6abbadce59698bc4df3ce783
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Wed Apr 12 15:44:02 2023 -0400

    services: syslog: Add a reload action.
    
    * gnu/services/base.scm (syslog-service-type) [actions]: Add a reload 
action.
    * doc/guix.texi (Base Services): Document it.
---
 doc/guix.texi         | 12 ++++++++++++
 gnu/services/base.scm | 16 +++++++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index adb1975935..53035fd5e9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18573,6 +18573,18 @@ Type of the service that runs the syslog daemon, whose 
value is a
 @code{<syslog-configuration>} object.
 @end defvar
 
+To have a modified @code{syslog-configuration} come into effect after
+reconfiguring your system, the @samp{reload} action should be preferred
+to restarting the service, as many services such as the login manager
+depend on it and would be restarted as well:
+
+@example
+# herd reload syslog
+@end example
+
+which will cause the running @command{syslogd} process to reload its
+configuration.
+
 @deftp {Data Type} syslog-configuration
 Data type representing the configuration of the syslog daemon.
 
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 3b0784ef07..7ef6db8ad4 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1549,7 +1549,21 @@ Service Switch}, for an example."
    (documentation "Run the syslog daemon (syslogd).")
    (provision '(syslogd))
    (requirement '(user-processes))
-   (actions (list (shepherd-configuration-action syslog.conf)))
+   (actions
+    (list (shepherd-configuration-action syslog.conf)
+          (shepherd-action
+           (name 'reload)
+           (documentation "Reload the configuration file from disk.")
+           (procedure
+            #~(lambda (pid)
+                (if pid
+                    (begin
+                      (kill pid SIGHUP)
+                      (display #$(G_ "Service syslog has been asked to \
+reload its settings file.")))
+                    (display #$(G_ "Service syslog is not running."))))))))
+   ;; Note: a static file name is used for syslog.conf so that the reload
+   ;; action work as intended.
    (start #~(let ((spawn (make-forkexec-constructor
                           (list #$(syslog-configuration-syslogd config)
                                 #$(string-append "--rcfile=" syslog.conf))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]