From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id oJDBOv+pw1/ORwAA0tVLHw (envelope-from ) for ; Sun, 29 Nov 2020 14:02:39 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 0FaONv+pw19lNQAA1q6Kng (envelope-from ) for ; Sun, 29 Nov 2020 14:02:39 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 48B5F940483 for ; Sun, 29 Nov 2020 14:02:39 +0000 (UTC) Received: from localhost ([::1]:51008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kjNHh-0000wU-Ek for larch@yhetil.org; Sun, 29 Nov 2020 09:02:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kjNHU-0000w6-DN for help-guix@gnu.org; Sun, 29 Nov 2020 09:02:24 -0500 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]:35916) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kjNHO-00044P-E6 for help-guix@gnu.org; Sun, 29 Nov 2020 09:02:24 -0500 Received: by mail-ej1-x632.google.com with SMTP id lt17so15589545ejb.3 for ; Sun, 29 Nov 2020 06:02:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CV8+GrooJ6ASxuAxdUyg8XXFHU9911DUSzP1F/VyeTQ=; b=GoZINvZzC0Rwq35SuGjyEuuN+HrtZqzXCatyOzZcAE4j6Slj3mz0Rv7iR7OQqsvR5f 60o+kiy9CweYlzMAHNeiie53XoEcY/W/PA+v0ZyBzMHvZUJ+4Y0JxxBfCLCbUB0Gkaye 7nlR8BHYqpS1f0Suwe4puChQZ7MB6wvdpT173oNbs8AecePtWNonWhXZ6TL0qCKgCRhZ A1Ke5Jl4/3A+IMT3Lgl+z7RQaYC45GMWHGd+zp/UbDLIMpTjNUNPUtfx8UGMUw0Qp8wg Gsg1vDj3rPslIwB5VBgeJaEBYQyNKna2jak1kznxpxXH25AJwmoB2RexVq/7ZwPdlfqI UzXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CV8+GrooJ6ASxuAxdUyg8XXFHU9911DUSzP1F/VyeTQ=; b=ciBnfmMwLcN0J/BuI2O6qNLgU+HshqIec+9v9k4E3wCC73wAfgeoSh1GgIDl6tNgOn pKrcf+CVGcVu+ipRA49fItS5x2zg3/wwo7H3/JbQwfGLD32qijLs+NELVI2gyh1TJNjj uySreIM98UGbcy79J4ZjsgPFv1UX8kL7XpagoIull4lFR8q1RUnGiHDhC1g7RAfw73Ht IEFisxwkUws/hAl+PIZvgpZ2TlMnduALbvj0nJXWp+0DYPQsZwOFy1p+tFyscW7VN7Qp xqFKcQ2pq1WKvc0yPeqUKtEo4SXgKyCesjOw7Ul6tqVLrbqR4STG5YskVW3thdCOqOR5 ULlw== X-Gm-Message-State: AOAM532JslaQbeJUsajlWbx1a88SVNiZWL50REOrEVGh2MoA0D5eBIeG sJdvPJJXGXJe7ZEQT1bp91V2bFiGqxFcjWHLfqc= X-Google-Smtp-Source: ABdhPJxjExiXCotUxpmQQnRuq0AxlAuQSBe3e3IR85uzvIypUYQv2QYATrvySidmDfViHrzsUc6G44DqMrxmcHUEUao= X-Received: by 2002:a17:906:57cc:: with SMTP id u12mr16316383ejr.163.1606658534645; Sun, 29 Nov 2020 06:02:14 -0800 (PST) MIME-Version: 1.0 References: <87k0u5msuc.fsf@euandre.org> <87blfhtrjk.fsf@cbaines.net> In-Reply-To: <87blfhtrjk.fsf@cbaines.net> From: Jason Conroy Date: Sun, 29 Nov 2020 09:01:38 -0500 Message-ID: Subject: Re: Manual: why not restart service over killing the process To: Christopher Baines Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=conjaroy@gmail.com; helo=mail-ej1-x632.google.com 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: EuAndreh , help-guix@gnu.org Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.18 X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=gmail.com header.s=20161025 header.b=GoZINvZz; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-TUID: vo+Whk/PYbJR Perhaps a third option is adding a Shepherd "reload" action for nginx to perform the SIGHUP, similar to this? https://git.savannah.gnu.org/cgit/guix.git/commit/gnu/services/base.scm?id=d3f75179e5741db29358e3e723146fd20ec79de9 I'm curious whether this approach has trade-offs compared to what's documented in the manual. Jason On Sat, Nov 28, 2020 at 10:44 AM Christopher Baines wrote: > > EuAndreh writes: > > > Hi! > > > > The manual suggests a deploy-hook for the certbot-service-type that > > looks like this: > > > > (define %nginx-deploy-hook > > (program-file > > "nginx-deploy-hook" > > #~(let ((pid (call-with-input-file "/var/run/nginx/pid" read))) > > (kill pid SIGHUP)))) > > > > Instead of requiring the deploy-hook to know the path of the PID file, > > why not restart the Shepherd service instead? Something like this: > > > > (define %nginx-deploy-hook > > (program-file > > "nginx-deploy-hook" > > (with-imported-modules '((gnu services herd)) > > #~(begin > > (use-modules (gnu services herd)) > > (restart-service 'nginx))))) > > > > If I understood correctly, those would result in equivalent outcomes, > > and I tend to find the latter a more elegant approach. It is a bit > > longer, but I like more restarting the service rather than killing the > > process. Is there any downside I'm missing? > > You're sort of right, but you've got the downsides the wrong way around. > > The key bit with the kill call is the SIGHUP but, not that it's not > SIGKILL. The current situation won't kill the NGinx process, but instead > just get it to reload the certificate (at least that's the intention). > > The restart action would "kill" the process, in that it would send it > SIGTERM and the the shepherd would start a new NGinx process, and this > has the potential of interrupting whatever is using NGinx. > > Does that make sense? >