From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <guix-devel-bounces+larch=yhetil.org@gnu.org>
Received: from mp0.migadu.com ([2001:41d0:403:58f0::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms8.migadu.com with LMTPS
	id SLFODbhAAWYrZwEAqHPOHw:P1
	(envelope-from <guix-devel-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Mon, 25 Mar 2024 10:15:36 +0100
Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp0.migadu.com with LMTPS
	id SLFODbhAAWYrZwEAqHPOHw
	(envelope-from <guix-devel-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Mon, 25 Mar 2024 10:15:36 +0100
X-Envelope-To: larch@yhetil.org
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=riseup.net header.s=squak header.b=XMt7ieDg;
	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=riseup.net
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1711358136;
	h=from:from:sender:sender: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=hoNJpjydNOTiVQIn87qLEkwOxKTyRh+1btJ5K6SjybY=;
	b=iTh5NAYFzM7U7MHVgEeMiwF+I/49TQ4lsi2Vs65bRt9/3g+fBmeycF8OtZNyEtDv0O5t2O
	bC6cKB7BAWf2sPkWz7/1ZKDQTMeWchwZTF+QhUyCwX0u3dM6s/f9i2Za1/7JY0XbBStyDb
	h71iTpya44IhU53TbgZ5ICCpikQcvOyC8F6heQzAPvExa5NYkupFfcp91+MbEz8HIK0E86
	LWv3Yta0pYbvOlPRQ48VKnzLv2XPcBNmulete/x6U4kLw0z9jSFrYx3riwZKmAoAnwRWdQ
	K+vhlpyT7ODcGT9n0CXKTXrgVfzYWGGtE9qa9lfE+g0qOxzZTKX1IdVnI6/eqw==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=riseup.net header.s=squak header.b=XMt7ieDg;
	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=riseup.net
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1711358136; a=rsa-sha256; cv=none;
	b=ojmnkl0Pw+6x0fkl4+jLiQ26pCYhTqLjuNrv+PrFJs1Ivxx/OumdqBkv0+Dm4od6Qyz9Ws
	n23MWJL6BZum5IZH3ZI7I5FampfiR9xtohb7bMDrVA82cA7TOalmSW9lnbf7y14zqaIj02
	AeqvL0DHGr4k0pI3fPUvNGsklBi4XdLGvS10jIFlZbIFba8oKcoCUxVW4fYlUbME4RkF/K
	7R/QyAjBJR6Og42DoPI1QdgrgS2AAdIWdgr0GadYXlKw27ZrjERrImUT6YyVjp805SQujK
	LWBvKR+1sx9+e9J72AsRmMY/DRYoNhrdbZ3ntmTyetR1JKzvF3sva3wR5k/gIg==
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 11DA63B657
	for <larch@yhetil.org>; Mon, 25 Mar 2024 10:15:36 +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 1rogPp-0000NR-Hu; Mon, 25 Mar 2024 05:14:49 -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 <raingloom@riseup.net>)
 id 1rogPn-0000NB-3M
 for guix-devel@gnu.org; Mon, 25 Mar 2024 05:14:47 -0400
Received: from mx0.riseup.net ([198.252.153.6])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <raingloom@riseup.net>)
 id 1rogPl-0002mI-17; Mon, 25 Mar 2024 05:14:46 -0400
Received: from fews01-sea.riseup.net (fews01-sea-pn.riseup.net [10.0.1.109])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by mx0.riseup.net (Postfix) with ESMTPS id 4V36hJ0Ytvz9wnJ;
 Mon, 25 Mar 2024 09:14:40 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak;
 t=1711358080; bh=UvRO7rvEp+Bd7ifJwiuhiplQ0zKebii0WZyt+wk2IM4=;
 h=Date:From:To:Cc:Subject:In-Reply-To:References:From;
 b=XMt7ieDg9biHawHyVZhthB54fT5Ln1rm1E+ZSau6QD5AQID5laCshz6kMitZOkJsf
 UVp34/TEVEjiypABBbLqKeswv7fpVSaqheur0LVhXLiC/pxbSjKIEuJA1PwbcqOQFo
 Lt6Qh2URRc+t19VwOzm6heuBTaHIZt0fetkWivME=
X-Riseup-User-ID: 8FB197742526942074555E4A04CB63AF65272C4AA6F0445AE9DA8B968218DD6E
Received: from [127.0.0.1] (localhost [127.0.0.1])
 by fews01-sea.riseup.net (Postfix) with ESMTPSA id 4V36hH6V97zJrXv;
 Mon, 25 Mar 2024 09:14:39 +0000 (UTC)
MIME-Version: 1.0
Date: Mon, 25 Mar 2024 09:14:39 +0000
From: raingloom@riseup.net
To: =?UTF-8?Q?Ludovic_Court=C3=A8s?= <ludo@gnu.org>
Cc: Guix Devel <guix-devel@gnu.org>
Subject: Re: Shepherd timers
In-Reply-To: <87jzlrpbsr.fsf@gnu.org>
References: <87jzlrpbsr.fsf@gnu.org>
Message-ID: <52d74fdc10823957b60b233f52df1638@riseup.net>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=198.252.153.6; envelope-from=raingloom@riseup.net;
 helo=mx0.riseup.net
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 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,
 RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-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>
Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org
Sender: guix-devel-bounces+larch=yhetil.org@gnu.org
X-Migadu-Flow: FLOW_IN
X-Migadu-Country: US
X-Migadu-Queue-Id: 11DA63B657
X-Spam-Score: -10.89
X-Migadu-Spam-Score: -10.89
X-Migadu-Scanner: mx11.migadu.com
X-TUID: HyvSArf/t7MN

On 2024-03-24 22:20, Ludovic Courtès wrote:
> Hello Guix!
> 
> I pushed to the ‘devel’ branch of the Shepherd a new module that
> implements “timers” along with ‘herd’ support to display information
> about them.
> 
> It lets you provide configuration like this one:
> 
> --8<---------------cut here---------------start------------->8---
> (use-modules (shepherd service timer))
> 
> (define timer
>   (service '(my-timer)
>            #:start (make-timer-constructor
>                     (calendar-event #:seconds '(0 7 15 22 30 45))
>                     (command '("sh" "-c" "echo Hi from $PWD.; sleep 20; echo done")))
>            #:stop (make-timer-destructor)))
> 
> (register-services (list timer))
> (start-in-the-background '(my-timer))
> --8<---------------cut here---------------end--------------->8---
> 
> And then ‘my-timer’ invokes the given command at the moments that match
> the constraints defined by ‘calendar-event’—in this case any time the
> number of seconds is equal to 0, 7, 15, 22, 30, or 45.  You can also
> make it every Monday at 9AM etc., as you would expect.
> 
> The ‘herd’ command provides details information about the timer:
> 
> --8<---------------cut here---------------start------------->8---
> $ ./herd -s sock status my-timer
> Status of my-timer:
>   It is running since 21:09:32 (68 seconds ago).
>   Timed service.
>   Periodically running: sh -c "echo Hi from $PWD.; sleep 20; echo done".
>   Child process: 1814
>   It is enabled.
>   Provides (my-timer).
>   Requires ().
>   Will not be respawned.
> 
> Recent runs:
>   2024-03-24 21:10:04 Process exited successfully.
>   2024-03-24 21:10:19 Process exited successfully.
>   2024-03-24 21:10:26 Process exited successfully.
>   2024-03-24 21:10:34 Process exited successfully.
>   2024-03-24 21:10:35 Process terminated with signal 15.
> 
> Recent messages:
>   2024-03-24 21:10:29 Hi from /home/ludo.
> 
> Upcoming timer alarms:
>   21:10:45 (in 5 seconds)
>   21:11:00 (in 20 seconds)
>   21:11:07 (in 27 seconds)
>   21:11:15 (in 35 seconds)
>   21:11:22 (in 42 seconds)
> --8<---------------cut here---------------end--------------->8---
> 
> And of course you can do anything you can do with a service: stop it,
> unload it, load a replacement, and so on.
> 
> Feedback & suggestions welcome!
> 
> Ludo’.

Does it support RTC wakeup?