[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 05/06: service: Introduce 'default-pid-file-timeout'.
From: |
Ludovic Courtès |
Subject: |
[shepherd] 05/06: service: Introduce 'default-pid-file-timeout'. |
Date: |
Sat, 18 Apr 2020 11:13:46 -0400 (EDT) |
civodul pushed a commit to branch master
in repository shepherd.
commit 8cfcbff59e0f223a7d5a37d2c684e0656510db5d
Author: Ludovic Courtès <address@hidden>
AuthorDate: Sat Apr 18 17:06:33 2020 +0200
service: Introduce 'default-pid-file-timeout'.
* modules/shepherd/service.scm (default-pid-file-timeout): New variable.
(%pid-file-timeout): Remove.
(read-pid-file, make-forkexec-constructor): Use it as the default
#:pid-file-timeout.
* doc/shepherd.texi (Service De- and Constructors): Document it.
---
doc/shepherd.texi | 8 +++++++-
modules/shepherd/service.scm | 13 +++++++------
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/doc/shepherd.texi b/doc/shepherd.texi
index 2394f95..9de9586 100644
--- a/doc/shepherd.texi
+++ b/doc/shepherd.texi
@@ -893,7 +893,7 @@ execution of the @var{command} was successful, @code{#t} if
not.
@deffn {procedure} make-forkexec-constructor @var{command} @
[#:user #f] @
[#:group #f] @
- [#:pid-file #f] [#:pid-file-timeout %pid-file-timeout] @
+ [#:pid-file #f] [#:pid-file-timeout (default-pid-file-timeout)] @
[#:log-file #f] @
[#:directory (default-service-directory)] @
[#:environment-variables (default-environment-variables)]
@@ -972,6 +972,12 @@ returns when the program starts (@pxref{Runtime
Environment,
@code{environ},, guile, GNU Guile Reference Manual}).
@end defvr
+@defvr {Scheme Variable} default-pid-file-timeout
+This parameter (@pxref{Parameters,,, guile, GNU Guile Reference Manual})
+specified the default PID file timeout in seconds, when
+@code{#:pid-file} is used (see above). It defaults to 5 seconds.
+@end defvr
+
@c @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@node Service Examples
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 79c4e9f..1c85f42 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -77,6 +77,7 @@
make-kill-destructor
exec-command
fork+exec-command
+ default-pid-file-timeout
read-pid-file
make-system-constructor
make-system-destructor
@@ -720,7 +721,11 @@ results."
;; set when starting a service.
(make-parameter (environ)))
-(define* (read-pid-file file #:key (max-delay 5)
+(define default-pid-file-timeout
+ ;; Maximum number of seconds to wait for a PID file to show up.
+ (make-parameter 5))
+
+(define* (read-pid-file file #:key (max-delay (default-pid-file-timeout))
(validate-pid? #f))
"Wait for MAX-DELAY seconds for FILE to show up, and read its content as a
number. Return #f if FILE was not created or does not contain a number;
@@ -890,10 +895,6 @@ its PID."
#:environment-variables environment-variables)
pid)))
-(define %pid-file-timeout
- ;; Maximum number of seconds we wait for a PID file to show up.
- 5)
-
(define make-forkexec-constructor
(let ((warn-deprecated-form
;; Until 0.1, this procedure took a rest list.
@@ -921,7 +922,7 @@ start."
(directory (default-service-directory))
(environment-variables (default-environment-variables))
(pid-file #f)
- (pid-file-timeout %pid-file-timeout)
+ (pid-file-timeout (default-pid-file-timeout))
(log-file #f))
(let ((command (if (string? command)
(begin
- [shepherd] branch master updated (6b0e1e1 -> b5c164b), Ludovic Courtès, 2020/04/18
- [shepherd] 03/06: system: Add 'getpgid'., Ludovic Courtès, 2020/04/18
- [shepherd] 01/06: service: 'check-for-dead-services' uses 'catch-system-error'., Ludovic Courtès, 2020/04/18
- [shepherd] 04/06: service: 'make-kill-destructor' kills the process group., Ludovic Courtès, 2020/04/18
- [shepherd] 05/06: service: Introduce 'default-pid-file-timeout'.,
Ludovic Courtès <=
- [shepherd] 02/06: service: Terminate the progress group when the PID file doesn't show up., Ludovic Courtès, 2020/04/18
- [shepherd] 06/06: service: 'make-forkexec-constructor' no longer supports the 0.1 form., Ludovic Courtès, 2020/04/18