unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Clément Lassieur" <clement@lassieur.org>
To: 26830@debbugs.gnu.org
Subject: bug#26830: [PATCH] services: shepherd: Allow services to implement a 'reload' action.
Date: Wed, 10 May 2017 21:31:37 +0200	[thread overview]
Message-ID: <20170510193137.846-1-clement@lassieur.org> (raw)
In-Reply-To: <86vapa6nyi.fsf@gmail.com>

* 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
+@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

  reply	other threads:[~2017-05-10 19:32 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08 15:25 bug#26830: Allow services to implement a 'reload' action Clément Lassieur
2017-05-08 15:28 ` bug#26830: [PATCH 1/4] services: shepherd: " Clément Lassieur
2017-05-08 15:28   ` bug#26830: [PATCH 2/4] gnu: services: nginx: Add " Clément Lassieur
2017-05-08 15:28   ` bug#26830: [PATCH 3/4] gnu: services: prosody: " Clément Lassieur
2017-05-08 15:28   ` bug#26830: [PATCH 4/4] gnu: services: dovecot: " Clément Lassieur
2017-05-09 15:37 ` bug#26830: Allow services to implement " Mathieu Othacehe
2017-05-10 19:31   ` Clément Lassieur [this message]
2017-05-11  7:13     ` bug#26830: [PATCH] services: shepherd: " Clément Lassieur
2017-05-11 12:40       ` Clément Lassieur
2017-05-11 12:57         ` Mathieu Othacehe
2017-05-10 19:31   ` bug#26830: " Clément Lassieur
2017-05-11 21:24   ` Ludovic Courtès
2017-05-11 23:08     ` Clément Lassieur
2017-05-12  8:25       ` Ludovic Courtès
2017-05-12  8:57         ` Clément Lassieur
2018-01-28 20:34           ` [bug#26830] " Danny Milosavljevic
2018-01-28 23:23             ` Clément Lassieur
2018-07-11 22:00     ` Ludovic Courtès
2018-07-12 13:06       ` Clément Lassieur
2022-03-23 12:56       ` zimoun
2022-03-24  8:41         ` Ludovic Courtès
2022-03-24 13:52           ` Oleg Pykhalov
2022-03-26 20:46             ` Ludovic Courtès
2022-03-26 21:14               ` Maxime Devos
2022-03-29 13:36                 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170510193137.846-1-clement@lassieur.org \
    --to=clement@lassieur.org \
    --cc=26830@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).