unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Dale Mellor <mcron-lsfnyl@rdmp.org>
Cc: 36510@debbugs.gnu.org
Subject: bug#36510: confusing mcron logging
Date: Mon, 28 Nov 2022 22:31:38 -0500	[thread overview]
Message-ID: <87o7sqqvvp.fsf@gmail.com> (raw)
In-Reply-To: <874jut2jam.fsf_-_@gmail.com> (Maxim Cournoyer's message of "Sun,  20 Nov 2022 20:22:25 -0500")

Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> Dale Mellor <mcron-lsfnyl@rdmp.org> writes:

[...]

>> The output is a little unpredictable.  The script (which is
>>    admittedly somewhat pathological)
>>
>>      (job '(next-second '(0 30)) '(begin (display "test: ")
>>                                          (system "date")))
>>
>>    produces
>>
>>      2022-01-04T11:24:00 (...): running...
>>      2022-01-04T11:24:00 (...): Tue 4 Jan 11:24:00 GMT 2022
>>      2022-01-04T11:24:00 (...): test: completed in 0.022s
>>      2022-01-04T11:24:30 (...): running...
>>      2022-01-04T11:24:30 (...): Tue 4 Jan 11:24:30 GMT 2022
>>      2022-01-04T11:25:00 (...): running...
>>      2022-01-04T11:25:00 (...): Tue 4 Jan 11:25:00 GMT 2022
>>      ...

I tried reproducing this, but couldn't, using the latest GNU Shepherd as
shipped in Guix.

> I've noticed that too, that some jobs somehow escape producing the
> "completed in x..." message.  I'll try looking into that, it's probably
> a subtle bug.

I took some time looking at the issue, and it was more straightforward
than I had hoped: I was using exec in my job, which was basically
hijacking the mcron's forked job process and loosing what it would have
normally done upon completion (print status).  Turning the 'execl' calls
into 'system*' fixed it:

--8<---------------cut here---------------start------------->8---
modified   guix/hurd.scm
@@ -36,14 +36,14 @@
   ;; Run 'updatedb' at 3AM every day.
   #~(job '(next-hour '(3))
          (lambda ()
-           (execl #$(file-append findutils "/bin/updatedb") "updatedb"
-                  (string-append "--prunepaths="
-                                 "/gnu/store "
-                                 "/media "
-                                 "/mnt "
-                                 "/tmp "
-                                 "/var/tmp "
-                                 "/var/lib ")))
+           (system* #$(file-append findutils "/bin/updatedb")
+                    (string-append "--prunepaths="
+                                   "/gnu/store "
+                                   "/media "
+                                   "/mnt "
+                                   "/tmp "
+                                   "/var/tmp "
+                                   "/var/lib ")))
          "updatedb"))
 
 (define btrfs-balance-job
@@ -52,15 +52,15 @@
   ;; low (5%) to minimize wear on the SSD.  Runs at 5 AM every 3 days.
   #~(job '(next-hour-from (next-day (range 1 31 3)) '(5))
          (lambda ()
-           (execl #$(file-append btrfs-progs "/bin/btrfs") "btrfs"
-                  "balance" "start" "-dusage=5" "/"))
+           (system* #$(file-append btrfs-progs "/bin/btrfs")
+                    "balance" "start" "-dusage=5" "/"))
          "btrfs-balance"))
 
 (define btrbk-job
   #~(job '(next-hour)
          (lambda ()
-           (execl #$(file-append btrbk "/bin/btrbk") "btrbk"
-                  "-q" "-c" #$(local-file "btrbk.conf") "run"))
+           (system* #$(file-append btrbk "/bin/btrbk")
+                    "-q" "-c" #$(local-file "btrbk.conf") "run"))
          "btrbk"))
 
--8<---------------cut here---------------end--------------->8---

-- 
Thanks,
Maxim




      reply	other threads:[~2022-11-29  3:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-05 13:35 bug#36510: confusing mcron logging Robert Vollmert
2019-07-05 20:37 ` Ludovic Courtès
2019-07-05 20:48   ` Robert Vollmert
2021-08-18  0:53   ` Maxim Cournoyer
2021-08-24 12:32     ` Maxim Cournoyer
2021-08-30  9:49     ` Ludovic Courtès
2022-01-04 13:21 ` bug#36510: [PATCH v3] base: Annotate output with job information Dale Mellor
2022-11-21  1:22   ` bug#36510: confusing mcron logging Maxim Cournoyer
2022-11-29  3:31     ` Maxim Cournoyer [this message]

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7sqqvvp.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=36510@debbugs.gnu.org \
    --cc=mcron-lsfnyl@rdmp.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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).