GNU bug report logs -
#32433
[PATCH] services: nginx: Get the Shepherd to respawn NGINX.
Previous Next
Reported by: Clément Lassieur <clement <at> lassieur.org>
Date: Mon, 13 Aug 2018 21:49:01 UTC
Severity: normal
Tags: patch
Done: Clément Lassieur <clement <at> lassieur.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32433 in the body.
You can then email your comments to 32433 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#32433
; Package
guix-patches
.
(Mon, 13 Aug 2018 21:49:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Clément Lassieur <clement <at> lassieur.org>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Mon, 13 Aug 2018 21:49:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* gnu/services/web.scm (nginx-shepherd-service): Change 'start' (that is, all
actions that don't send a signal to the master process) to return the PID.
Wait until the PID file is created and contains an integer because it might be
created after the parent process exits.
---
gnu/services/web.scm | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 97976509b..467656444 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -599,19 +599,33 @@ of index files."
<nginx-configuration>
(nginx file run-directory)
(let* ((nginx-binary (file-append nginx "/sbin/nginx"))
+ (pid-file (in-vicinity run-directory "pid"))
(nginx-action
(lambda args
#~(lambda _
(invoke #$nginx-binary "-c"
#$(or file
(default-nginx-config config))
- #$@args)))))
+ #$@args)
+ (match '#$args
+ (("-s" . _) #t)
+ (_
+ (let loop ((duration 0))
+ ;; https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1581864/comments/7
+ (sleep duration)
+ (if (file-exists? #$pid-file)
+ (let ((pid (call-with-input-file #$pid-file read)))
+ ;; it could be #<eof>
+ (if (integer? pid) pid (loop 1)))
+ (loop 1)))))))))
;; TODO: Add 'reload' action.
(list (shepherd-service
(provision '(nginx))
(documentation "Run the nginx daemon.")
(requirement '(user-processes loopback))
+ (modules `((ice-9 match)
+ ,@%default-modules))
(start (nginx-action "-p" run-directory))
(stop (nginx-action "-s" "stop")))))))
--
2.18.0
Reply sent
to
Clément Lassieur <clement <at> lassieur.org>
:
You have taken responsibility.
(Fri, 31 Aug 2018 14:39:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Clément Lassieur <clement <at> lassieur.org>
:
bug acknowledged by developer.
(Fri, 31 Aug 2018 14:39:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 32433-done <at> debbugs.gnu.org (full text, mbox):
Clément Lassieur <clement <at> lassieur.org> writes:
> * gnu/services/web.scm (nginx-shepherd-service): Change 'start' (that is, all
> actions that don't send a signal to the master process) to return the PID.
> Wait until the PID file is created and contains an integer because it might be
> created after the parent process exits.
> ---
> gnu/services/web.scm | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
Pushed!
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 29 Sep 2018 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 323 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.