From patchwork Mon Oct 10 04:39:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: EuAndreh X-Patchwork-Id: 43259 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8D3F527BBEA; Mon, 10 Oct 2022 05:41:45 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2CD8027BBE9 for ; Mon, 10 Oct 2022 05:41:45 +0100 (BST) Received: from localhost ([::1]:52608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohkbo-0006KW-Aa for patchwork@mira.cbaines.net; Mon, 10 Oct 2022 00:41:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohkb8-0006K0-OV for guix-patches@gnu.org; Mon, 10 Oct 2022 00:41:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46269) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ohkb8-0008RD-G5 for guix-patches@gnu.org; Mon, 10 Oct 2022 00:41:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ohkb8-0000Ya-As for guix-patches@gnu.org; Mon, 10 Oct 2022 00:41:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58405] [PATCH] services: nginx: Add reload action Resent-From: EuAndreh Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 10 Oct 2022 04:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58405 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58405@debbugs.gnu.org Cc: EuAndreh X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16653768292083 (code B ref -1); Mon, 10 Oct 2022 04:41:02 +0000 Received: (at submit) by debbugs.gnu.org; 10 Oct 2022 04:40:29 +0000 Received: from localhost ([127.0.0.1]:45347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohkaa-0000XX-Tg for submit@debbugs.gnu.org; Mon, 10 Oct 2022 00:40:29 -0400 Received: from lists.gnu.org ([209.51.188.17]:49424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohkaZ-0000XO-BP for submit@debbugs.gnu.org; Mon, 10 Oct 2022 00:40:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohkaY-0006HG-TC for guix-patches@gnu.org; Mon, 10 Oct 2022 00:40:27 -0400 Received: from box.euandre.org ([46.101.160.115]:49551) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ohkaX-0008Iy-1M for guix-patches@gnu.org; Mon, 10 Oct 2022 00:40:26 -0400 Received: from authenticated-user (box.euandre.org [46.101.160.115]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by box.euandre.org (Postfix) with ESMTPSA id C1210FC3D4; Mon, 10 Oct 2022 01:39:49 -0300 (-03) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=euandre.org; s=mail; t=1665376790; bh=1lyHw7/3zgNoZ7hno+DURF3kWONiuZHb/eceFkD3Hu4=; h=From:To:Cc:Subject:Date:From; b=gBeZQlS2RKZ1gdTgqu88vfQqMjJMZDzHTZreUjWQP5N14vfioLFq9kk9QjCLm+OBQ tPtLucjdssjZIwd8fIbTP0G4pMBjVzSxwp1zLLYqNHI1KY/4LTyEs5kc3ijuzas3cV IK6bl9jtiZC7B8Mhft3HD7cVQStvt+YbfH0CMie8OwvVIoq8sJwT2+G5AkEmxnAVdw fDVE3kB3jk9TCe+45vINwSrJkzwSMyzpiXsoxsbyzTOL/DEir2LZlqUmsPkR+Fex3w t09RHMo6o1BW2VnJspNQI/8LCxVtPPJt6pzMRFKsePcUbs5i/DNrHoobm2WX+/RyeH ehMHWIZpyc1WA== Date: Mon, 10 Oct 2022 01:39:32 -0300 Message-Id: <20221010043932.28384-1-eu@euandre.org> MIME-Version: 1.0 Received-SPF: pass client-ip=46.101.160.115; envelope-from=eu@euandre.org; helo=box.euandre.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: EuAndreh X-ACL-Warn: , EuAndreh via Guix-patches X-Patchwork-Original-From: EuAndreh via Guix-patches via From: EuAndreh X-getmail-retrieved-from-mailbox: Patches In a new "reload" shepherd-action, send a SIGHUP to the NGINX master process, so that it can re-read the configuration file and start new worker processes. * gnu/services/web.scm (nginx-shepherd-service): Add the "reload" shepherd-action --- gnu/services/web.scm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gnu/services/web.scm b/gnu/services/web.scm index e5ab1a1180..227a577de3 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -807,7 +807,6 @@ (define (nginx-shepherd-service config) #~#t #~(read-pid-file #$pid-file)))))))) - ;; TODO: Add 'reload' action. (list (shepherd-service (provision '(nginx)) (documentation "Run the nginx daemon.") @@ -815,7 +814,19 @@ (define (nginx-shepherd-service config) (modules `((ice-9 match) ,@%default-modules)) (start (nginx-action "-p" run-directory)) - (stop (nginx-action "-s" "stop"))))))) + (stop (nginx-action "-s" "stop")) + (actions + (list + (shepherd-action + (name 'reload) + (documentation "Reload NGINX configuration file and restart worker processes.") + (procedure + #~(lambda (pid) + (if pid + (begin + (kill pid SIGHUP) + (format #t "Service NGINX (PID ~a) has been reloaded." pid)) + (format #t "Service NGINX is not running.")))))))))))) (define nginx-service-type (service-type (name 'nginx)