GNU bug report logs - #36510
confusing mcron logging

Previous Next

Package: guix;

Reported by: Robert Vollmert <rob <at> vllmrt.net>

Date: Fri, 5 Jul 2019 13:37:01 UTC

Severity: normal

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #31 received at 36510 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Dale Mellor <mcron-lsfnyl <at> rdmp.org>
Cc: 36510 <at> debbugs.gnu.org
Subject: Re: bug#36510: confusing mcron logging
Date: Mon, 28 Nov 2022 22:31:38 -0500
Hi,

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

> Dale Mellor <mcron-lsfnyl <at> 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




This bug report was last modified 2 years and 169 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.