From: Christopher Baines <mail@cbaines.net>
To: EuAndreh <eu@euandre.org>
Cc: help-guix@gnu.org
Subject: Re: Manual: why not restart service over killing the process
Date: Sat, 28 Nov 2020 15:44:15 +0000 [thread overview]
Message-ID: <87blfhtrjk.fsf@cbaines.net> (raw)
In-Reply-To: <87k0u5msuc.fsf@euandre.org>
[-- Attachment #1: Type: text/plain, Size: 1449 bytes --]
EuAndreh <eu@euandre.org> 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?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]
next prev parent reply other threads:[~2020-11-28 15:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-28 14:58 Manual: why not restart service over killing the process EuAndreh
2020-11-28 15:44 ` Christopher Baines [this message]
2020-11-28 21:51 ` EuAndreh
2020-11-29 14:01 ` Jason Conroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87blfhtrjk.fsf@cbaines.net \
--to=mail@cbaines.net \
--cc=eu@euandre.org \
--cc=help-guix@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.