From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8XLF-0007iH-6T for guix-patches@gnu.org; Wed, 10 May 2017 15:32:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8XL9-0003RR-Ae for guix-patches@gnu.org; Wed, 10 May 2017 15:32:09 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:34429) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d8XL9-0003RN-6q for guix-patches@gnu.org; Wed, 10 May 2017 15:32:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d8XL8-0003mc-Sh for guix-patches@gnu.org; Wed, 10 May 2017 15:32:02 -0400 Subject: bug#26830: [PATCH] services: shepherd: Allow services to implement a 'reload' action. Resent-Message-ID: From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Date: Wed, 10 May 2017 21:31:37 +0200 Message-Id: <20170510193137.846-1-clement@lassieur.org> In-Reply-To: <86vapa6nyi.fsf@gmail.com> References: <86vapa6nyi.fsf@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 26830@debbugs.gnu.org * gnu/services/shepherd.scm ()[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 +@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 @@ -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}). +@item @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 +@code{actions} (@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