From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 13 17:48:26 2018 Received: (at submit) by debbugs.gnu.org; 13 Aug 2018 21:48:26 +0000 Received: from localhost ([127.0.0.1]:49991 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fpKhO-0007sV-Dl for submit@debbugs.gnu.org; Mon, 13 Aug 2018 17:48:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50301) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fpKhM-0007sG-Or for submit@debbugs.gnu.org; Mon, 13 Aug 2018 17:48:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fpKhG-0003Rq-ME for submit@debbugs.gnu.org; Mon, 13 Aug 2018 17:48:19 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41634) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fpKhG-0003Rj-IX for submit@debbugs.gnu.org; Mon, 13 Aug 2018 17:48:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpKhE-0005t5-R0 for guix-patches@gnu.org; Mon, 13 Aug 2018 17:48:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fpKh9-0003QI-Vs for guix-patches@gnu.org; Mon, 13 Aug 2018 17:48:16 -0400 Received: from mail.lassieur.org ([83.152.10.219]:54140) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fpKh9-0003OV-L3 for guix-patches@gnu.org; Mon, 13 Aug 2018 17:48:11 -0400 Received: from localhost.localdomain (88.191.118.83 [88.191.118.83]) by mail.lassieur.org (OpenSMTPD) with ESMTPSA id 8c7e18e8 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Mon, 13 Aug 2018 21:48:05 +0000 (UTC) From: =?UTF-8?q?Cl=C3=A9ment=20Lassieur?= To: guix-patches@gnu.org Subject: [PATCH] services: nginx: Get the Shepherd to respawn NGINX. Date: Mon, 13 Aug 2018 23:47:50 +0200 Message-Id: <20180813214750.714-1-clement@lassieur.org> X-Mailer: git-send-email 2.18.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.1 (-----) * 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 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 # + (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 From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 31 10:38:30 2018 Received: (at 32433-done) by debbugs.gnu.org; 31 Aug 2018 14:38:30 +0000 Received: from localhost ([127.0.0.1]:40755 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fvkZC-0005LE-JG for submit@debbugs.gnu.org; Fri, 31 Aug 2018 10:38:30 -0400 Received: from mail.lassieur.org ([83.152.10.219]:53498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fvkZB-0005L5-9N for 32433-done@debbugs.gnu.org; Fri, 31 Aug 2018 10:38:29 -0400 Received: from newt (smtp.parrot.biz [62.23.167.188]) by mail.lassieur.org (OpenSMTPD) with ESMTPSA id c0d7dd8d (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO) for <32433-done@debbugs.gnu.org>; Fri, 31 Aug 2018 14:35:56 +0000 (UTC) References: <20180813214750.714-1-clement@lassieur.org> User-agent: mu4e 1.0; emacs 26.1 From: =?utf-8?Q?Cl=C3=A9ment?= Lassieur To: 32433-done@debbugs.gnu.org Subject: Re: [bug#32433] [PATCH] services: nginx: Get the Shepherd to respawn NGINX. In-reply-to: <20180813214750.714-1-clement@lassieur.org> Date: Fri, 31 Aug 2018 16:38:27 +0200 Message-ID: <87y3cmlhy4.fsf@lassieur.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 32433-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Cl=C3=A9ment Lassieur 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 mig= ht be > created after the parent process exits. > --- > gnu/services/web.scm | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) Pushed! From unknown Mon Aug 18 02:31:48 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 29 Sep 2018 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator