From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <guix-devel-bounces+larch=yhetil.org@gnu.org>
Received: from mp1.migadu.com ([2001:41d0:303:e16b::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms8.migadu.com with LMTPS
	id GNuyLDr/AWYsRgAA62LTzQ:P1
	(envelope-from <guix-devel-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Mon, 25 Mar 2024 23:48:26 +0100
Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp1.migadu.com with LMTPS
	id GNuyLDr/AWYsRgAA62LTzQ
	(envelope-from <guix-devel-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Mon, 25 Mar 2024 23:48:26 +0100
X-Envelope-To: larch@yhetil.org
Authentication-Results: aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b=SfjFYlLA;
	spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org";
	dmarc=pass (policy=none) header.from=gnu.org
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1711406906;
	h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:list-id:list-help:
	 list-unsubscribe:list-subscribe:list-post:dkim-signature;
	bh=lLiuBJoT8QnFjtt9cKgeS8gH2HofGqjdeOaB3bz5Ktw=;
	b=Up7g8IkfDEIJiZ6VbddtbL+WugmMysLv+bxKXv/aDWLLK/XXb3i2VOwdpg1aL22JR87igb
	nTiPadNcFJnyaZTt1nqP2+DRe9sxhuuK3dii2qFmShX+5cmnQBfgvnCXUwuShRNyYPlQ8L
	bfGRJIX/pM2clZGgM/RBLhoYoLOpNDLvEZ3SE490zqvAKNyKYu9mrKTZtT5cQHAe2LgNDi
	KQGR/dT8ov4xcNAVWEHvXBy2dro7/aa34T9AVI7Q+ig7EJ58G4/EispaSG5p8SMrlf1xmV
	RaXx9cPiGETUWbFmE4YzrFEODhoIyRa8kSGFthOkIBlm6XMBhpCXzSdQssUfZg==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b=SfjFYlLA;
	spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org";
	dmarc=pass (policy=none) header.from=gnu.org
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1711406906; a=rsa-sha256; cv=none;
	b=pNCnd59Lw3EBpaZR3gEmugq/rApwTESB+aUM/lFowxX5GFFwZd6AB9DHIBIDnt0EORFtNC
	yALMt76ongo/ByrliTm/V4YbeHNLUXo+N8PQ7S5S0EQ3kq8EvqToVsjkV+8ltifUY1ERlW
	lqJ7djpBuXJ8wW2eQCr/KdtL+iye72l52EluqCphKPdOwBiGET8JsOf/5OTWO9Ditu/o5e
	JU+qoWc8hLGm02s+mYiULuiwhQeo9Qg28HbiZ2m/YKLAJUBESDRGz67PD5+Epc7kjEqbLL
	BVOAfZWqg7mB59olkOoRkHa2EcdA8vEAng+XARjzFSx1Dnph2D8eaZZqxK5ckg==
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 19F6C465D3
	for <larch@yhetil.org>; Mon, 25 Mar 2024 23:48:26 +0100 (CET)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <guix-devel-bounces@gnu.org>)
	id 1rot6p-0000xI-9r; Mon, 25 Mar 2024 18:48:03 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <felix.lechner@lease-up.com>)
 id 1rot6n-0000ww-AB
 for guix-devel@gnu.org; Mon, 25 Mar 2024 18:48:01 -0400
Received: from sail-ipv4.us-core.com ([208.82.101.137])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256)
 (Exim 4.90_1) (envelope-from <felix.lechner@lease-up.com>)
 id 1rot6k-0000yv-4C; Mon, 25 Mar 2024 18:48:00 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=J0SBRodVtUEKuKf
 zJ154DAZPNPT5lagVWbI0yjcC9C4=;
 h=date:references:in-reply-to:subject:
 cc:to:from; d=lease-up.com; b=SfjFYlLA94eInnjeJGUKwTtS4srenAp4fvaeH5cM
 BNfA+hWCTFw5wS6ZjkyFw3GVoazfA1tyAqaTfKCDHSwQOicxeDT+PqcwQrRC6EWuq6hRwQ
 tcDzsczcm66PV5v0N/Wmop1348h2n4QJlsHKEScHhE4dc19TKuKcp7wiLtHKo=
Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id 0c94cc4d
 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); 
 Mon, 25 Mar 2024 22:47:52 +0000 (UTC)
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@gnu.org>, Guix Devel
 <guix-devel@gnu.org>
Cc: 
Subject: Re: Shepherd timers
In-Reply-To: <87jzlrpbsr.fsf@gnu.org>
References: <87jzlrpbsr.fsf@gnu.org>
Date: Mon, 25 Mar 2024 15:47:51 -0700
Message-ID: <877chq3p48.fsf@lease-up.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=208.82.101.137;
 envelope-from=felix.lechner@lease-up.com; helo=sail-ipv4.us-core.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, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: guix-devel@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Development of GNU Guix and the GNU System distribution."
 <guix-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-devel>,
 <mailto:guix-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/guix-devel>
List-Post: <mailto:guix-devel@gnu.org>
List-Help: <mailto:guix-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-devel>,
 <mailto:guix-devel-request@gnu.org?subject=subscribe>
Reply-to:  Felix Lechner <felix.lechner@lease-up.com>
From:  Felix Lechner via "Development of GNU Guix and the GNU System distribution."
 <guix-devel@gnu.org>
Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org
Sender: guix-devel-bounces+larch=yhetil.org@gnu.org
X-Migadu-Country: US
X-Migadu-Flow: FLOW_IN
X-Spam-Score: -6.84
X-Migadu-Queue-Id: 19F6C465D3
X-Migadu-Scanner: mx13.migadu.com
X-Migadu-Spam-Score: -6.84
X-TUID: l/m7jZYRDFN/

Hi Ludo',

On Sun, Mar 24 2024, Ludovic Court=C3=A8s wrote:

> I pushed to the =E2=80=98devel=E2=80=99 branch of the Shepherd a new modu=
le that
> implements =E2=80=9Ctimers=E2=80=9D

Wow, that's super exciting!  I promptly reconfigured my channels to pull
in the Shepherd branch.  (Anyone who wants to do the same, please reply
here for info.)  For me, Shepherd timers will allow the temporary
stoppage of individual cron jobs.

For a server that can make debugging much easier.

> (command '("sh" "-c" "echo Hi from $PWD.; sleep 20; echo done")))

The simple example worked great, but my more complex attempt to convert
an mcron job seems to have failed.  Do you know why?

--8<---------------cut here---------------start------------->8---
(define (rsync-debbugs-shepherd-service config)
  (shepherd-service
   (provision '(rsync-debbugs))
   (requirement '(networking file-systems))
   (modules '((shepherd service timer)
              (srfi srfi-1)))
   (start #~(make-timer-constructor
             (calendar-event #:minutes '(iota 12 3 5))
             (command `(,#$(file-append rsync "/bin/rsync")
                        "-4"
                        "--delete"
                        "-av"
                        "--password-file=3D/root/secrets/var-lib-debbugs.rs=
ync"
                        "debbugs-var@debbugs.gnu.org::var-lib-debbugs"
                        "/var/lib/debbugs/"))))
   (stop #~(make-timer-destructor))
   (documentation "Timer to rsync Debbugs bug details to this machine.")))

(define rsync-debbugs-service-type
  (service-type
   (name 'rsync-debbugs)
   (description
    "Rsync Debbugs bug details to this machine.")
   (extensions
    (list
     (service-extension shepherd-root-service-type
                        (compose list rsync-debbugs-shepherd-service))))
   (default-value #f)))
--8<---------------cut here---------------end--------------->8---

and then later

--8<---------------cut here---------------start------------->8---
            (service rsync-debbugs-service-type)
--8<---------------cut here---------------end--------------->8---

At the bottom of this message is the log from my Eshell session.  The
first funny thing was that the old timer info still showed in 'herd
status'.  That's probably because some services are not reloaded
automatically. I can never figure out which are and which aren't.

More important, however, I was unable to get status information from the
more complex timer service.  What did I do wrong, please?

Thanks for this excellent work, especially in calender-event.  The
Shepherd is a super cute piece of software!

Kind regards
Felix

* * *

guix deploy: successfully deployed wallace-server
#[STATUS] End time 2024-03-25 14:02:35, duration 86.932s
[~]
> cd /ssh:root@wallace-server.local:/srv/patchwise
(root@wallace-server.local)[/s/srv/patchwise]
> herd status rsync-debbugs
Status of rsync-debbugs:
  It is running since 13:44:40 (19 minutes ago).
  Timed service.
  Periodically running: sh -c "echo Hi from $PWD.; sleep 20; echo done".
  It is enabled.
  Provides (rsync-debbugs).
  Requires (networking file-systems).
  Will be respawned.

Recent runs:
  2024-03-25 14:03:06 Process exited with code 1.
  2024-03-25 14:03:14 Process exited with code 1.
  2024-03-25 14:03:21 Process exited with code 1.
  2024-03-25 14:03:29 Process exited with code 1.
  2024-03-25 14:03:44 Process exited with code 1.

Recent messages:
  2024-03-25 14:03:44 exec of "sh" failed: No such file or directory
  2024-03-25 14:03:44=20
  2024-03-25 14:03:44 Some deprecated features have been used.  Set the env=
ironment
  2024-03-25 14:03:44 variable GUILE_WARN_DEPRECATED to "detailed" and reru=
n the
  2024-03-25 14:03:44 program to get more information.  Set it to "no" to s=
uppress
  2024-03-25 14:03:44 this message.

Upcoming timer alarms:
  14:04:00 (in 15 seconds)
  14:04:07 (in 22 seconds)
  14:04:15 (in 30 seconds)
  14:04:22 (in 37 seconds)
  14:04:30 (in 45 seconds)
#[STATUS] End time 2024-03-25 14:03:45, duration 1.430s
(root@wallace-server.local)[/s/srv/patchwise]
> herd restart rsync-debbugs
Service user-homes has been started.
Starting service rsync-debbugs...
Service rsync-debbugs started.
Service rsync-debbugs running with value #<<timer> channel: #<<channel> get=
q: #<atomic-box 7fb467c1c990 value: (())> getq-gc-counter: #<atomic-box 7fb=
467c1c980 value: 42> putq: #<atomic-box 7fb467c1c960 value: (())> putq-gc-c=
ounter: #<atomic-box 7fb467c1c950 value: 42>> event: #<<calendar-event> sec=
onds: (0) minutes: (iota 12 3 5) hours: (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14=
 15 16 17 18 19 20 21 22 23) days-of-month: (1 2 3 4 5 6 7 8 9 10 11 12 13 =
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) months: (1 2 3 4 5 6=
 7 8 9 10 11 12) days-of-week: #f> action: #<<command> arguments: ("/gnu/st=
ore/1g0gk9pcymgc0bb1dh115swakmh438p6-rsync-3.2.7/bin/rsync" "-4" "--delete"=
 "-av" "--password-file=3D/root/secrets/var-lib-debbugs.rsync" "debbugs-var=
@debbugs.gnu.org::var-lib-debbugs" "/var/lib/debbugs/") user: #f group: #f =
environment-variables: ("HOME=3D/" "TERM=3Dlinux" "BOOT_IMAGE=3D/gnu/store/=
psn2jwyrvr8jxb1nrndxf3h7kg8vvfwa-linux-6.6.2/bzImage" "PATH=3D/gnu/store/2j=
bvnib5ar70q1vlhhngish1svqfry0j-e2fsck-static-1.46.4/sbin:/gnu/store/jlbzcgx=
xzhynv74ss2510b0x978srnf9-loadkeys-static-2.5.1/bin" "GUIX_LOCPATH=3D/gnu/s=
tore/5fmqijrs5f7vx8mc2q2pmq26yvhb74sm-glibc-utf8-locales-2.35/lib/locale") =
directory: "/" resource-limits: ()>>.
Service rsync-debbugs has been started.
#[STATUS] End time 2024-03-25 14:04:40, duration 1.081s
(root@wallace-server.local)[/s/srv/patchwise]
> herd status rsync-debbugs
#[STATUS] End time 2024-03-25 14:07:41, duration 159.524s
(root@wallace-server.local)[/s/srv/patchwise]
> herd restart mcron
Service user-homes has been started.
Starting service mcron...
Service mcron started.
Service mcron running with value #<<process> id: 4171 command: ("/gnu/store=
/2izimf0xymk3qm35i7lsqbhpid2235ik-mcron-1.2.3/bin/mcron" "--log" "--log-for=
mat" "~1@*~a ~a: ~a~%" "/gnu/store/annwvnihjy5sghw6s05l6kzijk6rbg93-mcron-j=
ob" "/gnu/store/dx7gyb3mrfzpwrsfjfjfnicmiqz7jszw-mcron-job" "/gnu/store/knf=
ag5iw4mqhf6lqb462p95zs3knici3-mcron-job" "/gnu/store/485wh62g950zgi2cjwh7q6=
rayag2p5mi-mcron-job" "/gnu/store/kxp8cd5x183zy10bd93mmvyxgm8b89q6-mcron-jo=
b" "/gnu/store/20a2d6pg5hckpsv2ap91y0sl2vdcx0jb-mcron-job" "/gnu/store/7l4c=
r6982gyldv8jz8lfvq8i4wcp65z6-mcron-job" "/gnu/store/srcq4hqg88s3nd22b4l3vkp=
g2gx03fyf-mcron-job")>.
Service mcron has been started.
#[STATUS] End time 2024-03-25 14:12:52, duration 1.333s
(root@wallace-server.local)[/s/srv/patchwise]
> herd status rsync-debbugs
#[STATUS] End time 2024-03-25 15:18:41, duration 10.155s

=20