summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-04-12 15:44:02 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-04-21 09:04:40 -0400
commit2c67e98b37e5b73c6abbadce59698bc4df3ce783 (patch)
tree0dbfe579025e8384bf5afa4e54377ba121674fe9 /gnu/services
parent1ae279d7c8a4962fedcb3479e551d21991d0ac4a (diff)
downloadguix-2c67e98b37e5b73c6abbadce59698bc4df3ce783.tar.gz
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.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/base.scm16
1 files changed, 15 insertions, 1 deletions
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))