From: Bruno Victal <mirai@makinata.eu>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 62163@debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: bug#62163: Suppress logging shepherd evaluation in mcron.log
Date: Tue, 28 Mar 2023 17:32:14 +0100 [thread overview]
Message-ID: <8164fa63-99bd-f1d5-2f21-628f079c6039@makinata.eu> (raw)
In-Reply-To: <875yakg7w2.fsf@gnu.org>
Hi Ludo’,
On 2023-03-28 17:25, Ludovic Courtès wrote:
>
> Nope. :-) What is ‘my-heartbeat-job’ doing?
It queries shepherd to see if a service is running and sends a restart if required.
It looks like this: (#$task is what will perform the actual checks)
--8<---------------cut here---------------start------------->8---
(define* (heartbeat-supervisor #:key (name #f) service task
#:allow-other-keys)
;; Query service status and restart if needed.
(program-file
(format #f "~@[~a-~]heartbeat-supervisor.scm" name)
(with-imported-modules (source-module-closure
'((gnu services herd)))
#~(begin
(use-modules (gnu services herd)
(srfi srfi-1))
(define (is-service-running? sym)
(lambda (x)
(and (live-service-running x)
(memq sym (live-service-provision x)))))
(let ((running? (not (null?
(any (is-service-running? '#$service)
(current-services))))))
(when running?
(case (status:exit-val (system* #$task))
((0) #t)
((125)
(format #t "Heartbeat worker error~%"))
(else
(format #t "Issuing restart for service '~a'~%" '#$service)
(restart-service '#$service)))))
(exit)))))
--8<---------------cut here---------------end--------------->8---
This message also shows up if you're using certbot-service-type,
so it's not specific to the snippet above.
Cheers,
Bruno
next prev parent reply other threads:[~2023-03-28 16:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-13 15:59 bug#62163: Suppress logging shepherd evaluation in mcron.log Bruno Victal
2023-03-24 12:22 ` Maxim Cournoyer
2023-03-28 16:25 ` Ludovic Courtès
2023-03-28 16:32 ` Bruno Victal [this message]
2023-03-30 10:22 ` Ludovic Courtès
2023-03-30 11:21 ` Bruno Victal
2023-03-31 2:10 ` Maxim Cournoyer
2023-03-31 12:18 ` Ludovic Courtès
2023-03-31 11:52 ` Bruno Victal
2023-03-31 22:10 ` Ludovic Courtès
2023-04-27 13:24 ` Ludovic Courtès
2023-04-27 16:12 ` Bruno Victal
2023-04-28 3:52 ` Maxim Cournoyer
2023-05-03 20:01 ` Ludovic Courtès
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=8164fa63-99bd-f1d5-2f21-628f079c6039@makinata.eu \
--to=mirai@makinata.eu \
--cc=62163@debbugs.gnu.org \
--cc=ludo@gnu.org \
--cc=maxim.cournoyer@gmail.com \
/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.