[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/05: services: shepherd: Support one-shot services.
From: |
guix-commits |
Subject: |
02/05: services: shepherd: Support one-shot services. |
Date: |
Tue, 23 Apr 2019 10:39:59 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 95ef8b85b16f19557ea07d0d0cbf856f85657368
Author: Ludovic Courtès <address@hidden>
Date: Tue Apr 23 14:48:56 2019 +0200
services: shepherd: Support one-shot services.
* gnu/services/shepherd.scm (<shepherd-service>)[one-shot?]: New field.
(shepherd-service-file): Pass #:one-shot? to the <service> constructor.
* doc/guix.texi (Shepherd Services): Document it.
---
doc/guix.texi | 6 ++++++
gnu/services/shepherd.scm | 10 +++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 3ec1cf8..955fd1f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -25124,6 +25124,12 @@ shepherd, The GNU Shepherd Manual}). @xref{Slots of
services, the
@item @code{requirements} (default: @code{'()})
List of symbols denoting the Shepherd services this one depends on.
address@hidden one-shot services, for the Shepherd
address@hidden @code{one-shot?} (default: @code{#f})
+Whether this service is @dfn{one-shot}. One-shot services stop immediately
+after their @code{start} action has completed. @xref{Slots of services,,,
+shepherd, The GNU Shepherd Manual}, for more info.
+
@item @code{respawn?} (default: @code{#t})
Whether to restart the service when it stops, for instance when the
underlying process dies.
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 12d649f..21baacb 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2018 Ludovic Courtès <address@hidden>
+;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2019 Ludovic Courtès
<address@hidden>
;;; Copyright © 2017 Clément Lassieur <address@hidden>
;;; Copyright © 2018 Carlo Zancanaro <address@hidden>
;;;
@@ -44,6 +44,7 @@
shepherd-service-provision
shepherd-service-canonical-name
shepherd-service-requirement
+ shepherd-service-one-shot?
shepherd-service-respawn?
shepherd-service-start
shepherd-service-stop
@@ -149,6 +150,8 @@ DEFAULT is given, use it as the service's default value."
(provision shepherd-service-provision) ;list of symbols
(requirement shepherd-service-requirement ;list of symbols
(default '()))
+ (one-shot? shepherd-service-one-shot? ;Boolean
+ (default #f))
(respawn? shepherd-service-respawn? ;Boolean
(default #t))
(start shepherd-service-start) ;g-expression
(procedure)
@@ -238,6 +241,11 @@ stored."
#:docstring '#$(shepherd-service-documentation service)
#:provides '#$(shepherd-service-provision service)
#:requires '#$(shepherd-service-requirement service)
+
+ ;; The 'one-shot?' slot is new in Shepherd 0.6.0.
+ ;; Older versions ignore it.
+ #:one-shot? '#$(shepherd-service-one-shot? service)
+
#:respawn? '#$(shepherd-service-respawn? service)
#:start #$(shepherd-service-start service)
#:stop #$(shepherd-service-stop service)