guix-patches
[Top][All Lists]
Advanced

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

bug#26830: [PATCH] services: shepherd: Allow services to implement a 're


From: Clément Lassieur
Subject: bug#26830: [PATCH] services: shepherd: Allow services to implement a 'reload' action.
Date: Wed, 10 May 2017 21:31:37 +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, Shepherd Services): Update accordingly.
---
 doc/guix.texi             | 14 +++++++++++---
 gnu/services/shepherd.scm |  9 ++++++++-
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 81aa957c6..2d2015df2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8674,9 +8674,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
address@hidden 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
@@ -16204,6 +16205,13 @@ Constructors,,, shepherd, The GNU Shepherd Manual}).  
They are given as
 G-expressions that get expanded in the Shepherd configuration file
 (@pxref{G-Expressions}).
 
address@hidden @code{reload} (default: @code{#f})
+The @code{reload} field refers to the Shepherd's facilities to reload
+the service's configuration files without restarting.  They are
address@hidden (@pxref{Slots of services,,, shepherd, The GNU Shepherd
+Manual}) and are given as G-expressions that get expanded in the
+Shepherd configuration file (@pxref{G-Expressions}).
+
 @item @code{documentation}
 A documentation string, as shown when running:
 
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






reply via email to

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