diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2026-03-28 15:22:05 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-04-07 13:26:20 +0200 |
| commit | c7cb771cf40d779cbce062c029ee51fbd7de181b (patch) | |
| tree | 079cb277598371c43052d8075abc2c90095e0293 /gnu/services | |
| parent | 4ac798a2844b55ba1dca2d7986ea3f31a3a7e497 (diff) | |
services: nginx: Fix ‘stop’ in cases where a custom config file is passed.
Previously, when the ‘file’ field of ‘nginx-configuration’ was true, the PID
file would be unknown; thus, the ‘start’ method would return #t and the ‘stop’
method would eventually fail with a type error because it would receive #t
instead of a process.
This fixes it by changing ‘stop’ to invoke “nginx -s stop” when the service’s
value is not a process.
* gnu/services/web.scm (nginx-shepherd-service): In ‘stop’, change to invoke
“nginx -s stop” when ‘value’ is not a process.
Fixes: guix/guix#7061
Reported-by: Dan Littlewood
Change-Id: I20ff065ecd2c64e5fc98f59c25d91b300bc7b4cd
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #7543
Diffstat (limited to 'gnu/services')
| -rw-r--r-- | gnu/services/web.scm | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/gnu/services/web.scm b/gnu/services/web.scm index 2056e0cca15..948d8064c6a 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2015 David Thompson <davet@gnu.org> | 2 | ;;; Copyright © 2015 David Thompson <davet@gnu.org> |
| 3 | ;;; Copyright © 2015-2023, 2025 Ludovic Courtès <ludo@gnu.org> | 3 | ;;; Copyright © 2015-2023, 2025-2026 Ludovic Courtès <ludo@gnu.org> |
| 4 | ;;; Copyright © 2016 Nikita <nikita@n0.is> | 4 | ;;; Copyright © 2016 Nikita <nikita@n0.is> |
| 5 | ;;; Copyright © 2016, 2017, 2018 Julien Lepiller <julien@lepiller.eu> | 5 | ;;; Copyright © 2016, 2017, 2018 Julien Lepiller <julien@lepiller.eu> |
| 6 | ;;; Copyright © 2017, 2018, 2019 Christopher Baines <mail@cbaines.net> | 6 | ;;; Copyright © 2017, 2018, 2019 Christopher Baines <mail@cbaines.net> |
| @@ -987,11 +987,15 @@ of index files." | |||
| 987 | (modules `((ice-9 match) | 987 | (modules `((ice-9 match) |
| 988 | ,@%default-modules)) | 988 | ,@%default-modules)) |
| 989 | (start (nginx-action "-p" run-directory)) | 989 | (start (nginx-action "-p" run-directory)) |
| 990 | 990 | (stop #~(lambda (value) | |
| 991 | ;; Instead of invoking "nginx -s stop", use | 991 | ;; When the PID is known, use 'terminate-process', which |
| 992 | ;; 'make-kill-destructor', which waits for the main process to | 992 | ;; waits for the main process to actually terminate. |
| 993 | ;; actually terminate. | 993 | ;; When FILE is true, there's potentially no PID file |
| 994 | (stop #~(make-kill-destructor)) | 994 | ;; and thus the PID is not known; in that case, invoke |
| 995 | ;; "nginx -s stop". | ||
| 996 | (if (process? value) | ||
| 997 | (terminate-process (process-id value) SIGTERM) | ||
| 998 | (#$(nginx-action "stop"))))) | ||
| 995 | 999 | ||
| 996 | (actions | 1000 | (actions |
| 997 | (list | 1001 | (list |
