GNU bug report logs - #26830
Allow services to implement a 'reload' action

Previous Next

Package: guix-patches;

Reported by: Clément Lassieur <clement <at> lassieur.org>

Date: Mon, 8 May 2017 15:26:01 UTC

Severity: important

Full log


View this message in rfc822 format

From: Clément Lassieur <clement <at> lassieur.org>
To: 26830 <at> debbugs.gnu.org
Subject: bug#26830: [PATCH 1/4] services: shepherd: Allow services to implement a 'reload' action.
Date: Mon,  8 May 2017 17:28:29 +0200
* gnu/services/shepherd.scm (<shepherd-service>)[reload]: Add it.
(shepherd-service-file): Add it to the Shepherd's service definition.
* doc/guix.texi (Services): Update accordingly.
---
 doc/guix.texi             | 7 ++++---
 gnu/services/shepherd.scm | 9 ++++++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 4446909ed..3ccfa8d9e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8671,9 +8671,10 @@ service:
 Run libc's name service cache daemon (nscd).
 @end example
 
-The @command{start}, @command{stop}, and @command{restart} sub-commands
-have the effect you would expect.  For instance, the commands below stop
-the nscd service and restart the Xorg display server:
+The @command{start}, @command{stop}, @command{restart} and
+@command{reload} sub-commands have the effect you would expect.  For
+instance, the commands below stop the nscd service and restart the Xorg
+display server:
 
 @example
 # herd stop nscd
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 7281746ab..17e53f774 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -47,6 +47,7 @@
             shepherd-service-respawn?
             shepherd-service-start
             shepherd-service-stop
+            shepherd-service-reload
             shepherd-service-auto-start?
             shepherd-service-modules
 
@@ -137,6 +138,8 @@ for a service that extends SHEPHERD-ROOT-SERVICE-TYPE and nothing else."
   (start         shepherd-service-start)               ;g-expression (procedure)
   (stop          shepherd-service-stop                 ;g-expression (procedure)
                  (default #~(const #f)))
+  (reload        shepherd-service-reload               ;g-expression (procedure)
+                 (default #f))
   (auto-start?   shepherd-service-auto-start?          ;Boolean
                  (default #t))
   (modules       shepherd-service-modules              ;list of module names
@@ -214,7 +217,11 @@ stored."
                       #:requires '#$(shepherd-service-requirement service)
                       #:respawn? '#$(shepherd-service-respawn? service)
                       #:start #$(shepherd-service-start service)
-                      #:stop #$(shepherd-service-stop service))))))
+                      #:stop #$(shepherd-service-stop service)
+                      #:actions (make-actions
+                                 (reload
+                                  "Reload the service's configuration files."
+                                  #$(shepherd-service-reload service))))))))
 
 (define (shepherd-configuration-file services)
   "Return the shepherd configuration file for SERVICES."
-- 
2.12.2





This bug report was last modified 3 years and 77 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.