[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/06: services: shepherd: Add respawn-limit and respawn-delay.
From: |
guix-commits |
Subject: |
04/06: services: shepherd: Add respawn-limit and respawn-delay. |
Date: |
Sun, 28 Jan 2024 16:54:06 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit dde76db33fbdede6bf26821f8c21cca7df45e79e
Author: Attila Lendvai <attila@lendvai.name>
AuthorDate: Thu Jan 25 16:05:41 2024 +0100
services: shepherd: Add respawn-limit and respawn-delay.
* gnu/services/shepherd.scm (<shepherd-service>): Add respawn-limit and
respawn-delay.
(shepherd-service-file): Emit the two values into the shepherd service
constructor form.
Change-Id: I54408e8fb4bcc0956d9610771bf5c566fdc2914c
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
doc/guix.texi | 9 +++++++++
gnu/services/shepherd.scm | 14 ++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/doc/guix.texi b/doc/guix.texi
index 58c3024642..bb0af26d93 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -43143,6 +43143,15 @@ shepherd, The GNU Shepherd Manual}, for more info.
Whether to restart the service when it stops, for instance when the
underlying process dies.
+@item @code{respawn-limit} (default: @code{#f})
+Set a limit on how many times and how frequently a service may be
+restarted by Shepherd before it is disabled. @xref{Defining
+Services,,, shepherd, The GNU Shepherd Manual}, for details.
+
+@item @code{respawn-delay} (default: @code{#f})
+When true, this is the delay in seconds before restarting a failed
+service.
+
@item @code{start}
@itemx @code{stop} (default: @code{#~(const #f)})
The @code{start} and @code{stop} fields refer to the Shepherd's
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 5ebac129ce..f5bcde721f 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -55,6 +55,8 @@
shepherd-service-canonical-name
shepherd-service-requirement
shepherd-service-one-shot?
+ shepherd-service-respawn-limit
+ shepherd-service-respawn-delay
shepherd-service-respawn?
shepherd-service-start
shepherd-service-stop
@@ -211,6 +213,10 @@ DEFAULT is given, use it as the service's default value."
(default #f))
(respawn? shepherd-service-respawn? ;Boolean
(default #t))
+ (respawn-limit shepherd-service-respawn-limit
+ (default #f))
+ (respawn-delay shepherd-service-respawn-delay
+ (default #f))
(start shepherd-service-start) ;g-expression
(procedure)
(stop shepherd-service-stop ;g-expression
(procedure)
(default #~(const #f)))
@@ -309,6 +315,14 @@ stored."
#:one-shot? '#$(shepherd-service-one-shot? service)
#:respawn? '#$(shepherd-service-respawn? service)
+ #$@(if (shepherd-service-respawn-limit service)
+ `(#:respawn-limit
+ ,(shepherd-service-respawn-limit service))
+ '())
+ #$@(if (shepherd-service-respawn-delay service)
+ `(#:respawn-delay
+ ,(shepherd-service-respawn-delay service))
+ '())
#:start #$(shepherd-service-start service)
#:stop #$(shepherd-service-stop service)
#:actions
- branch master updated (08ed3ec64e -> 65dc2d40cb), guix-commits, 2024/01/28
- 05/06: gnu: dynaconf: Update to 3.2.4., guix-commits, 2024/01/28
- 01/06: home: services: Add missing import., guix-commits, 2024/01/28
- 04/06: services: shepherd: Add respawn-limit and respawn-delay.,
guix-commits <=
- 06/06: gnu: fish: Update to 3.7.0., guix-commits, 2024/01/28
- 03/06: doc: Add index entries for “dot files” and “Stow”., guix-commits, 2024/01/28
- 02/06: home: Add home-dotfiles-service., guix-commits, 2024/01/28