From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id +F8iJhq9XGdphAAAe85BDQ:P1 (envelope-from ) for ; Fri, 13 Dec 2024 23:02:50 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id +F8iJhq9XGdphAAAe85BDQ (envelope-from ) for ; Sat, 14 Dec 2024 00:02:50 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=WCizCW2u; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=TmOGmgRg; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1734130970; a=rsa-sha256; cv=none; b=K9wBMDjkgyRHuueNXITX51XvuiysTmLDxl2++pW4C2VSv8WUAaane5FEhu+Dro7Ps1KK8X sLjplLisDdwXEaB28OqT8ngoRVyNnRCwSZ2o7UEPg/j9stFNeyS+/C18Q3bkDornkE8LtD buy+Et9WcBiH2/zgkgv9UQxm878gqdN6MC/X7LJJlhJa2apokJxeKP/+518BB8U1vTx2Bd n94o9tB/xP0UZqsPTI5C4gcphGpOQfO3wGFDlDHIyP7Ns7+VLKIPDMY1sCOR7bpUSAqQla XH4eSExV63rDfid8NhEzmxnpW+Ih+2JdGaig10JWsEncBI0hrTqPrNca0HuUQg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=WCizCW2u; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=TmOGmgRg; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1734130970; 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:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ayNrXZNb9B0f9xIavfgpUE0NtMrhv2/ggHdcgnRLIa8=; b=TTaISpuNgsulB/dPvfGKuJ14SDKvxWZvXxfHcjpzgUvvEo6C7aAU1c4DgwUesxi12LoOkn ORStHQINXuTwqoOUVGmOXn8KAEml4pi3d2S8vmyw8MpEkuQ3Wkp0bV8cc5rhFZ/wd30xke dWtxULIF4T/Op8vMOah2Zsb4Bl6yPknUigRmAPP8DX7TiT/1IsCJHFsg7hobAWVLHQYz8H FE0KG4ged9/YJqiqhRt8pz4ItgKa3rb05bFclE0kaQMBM9i6jJwbv5WkU9L+WLuNcwn9C9 1A68frH28D/uLURsm4h2zArVngD81wmR5e9L/klmT0g4+i5ua1hnlWcObrp2/Q== 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 5318F7E48B for ; Sat, 14 Dec 2024 00:02:49 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tMEfo-00040E-WC; Fri, 13 Dec 2024 18:02:17 -0500 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 ) id 1tMEfb-0003wU-N3 for guix-patches@gnu.org; Fri, 13 Dec 2024 18:02:05 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tMEfb-0002l1-C5; Fri, 13 Dec 2024 18:02:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=ayNrXZNb9B0f9xIavfgpUE0NtMrhv2/ggHdcgnRLIa8=; b=WCizCW2u8ddZ4Mw4z5cZuVpzbRKTdDnBfNPZGLy4MkiSRb3ZFrVz0mPeF3frEHri1FrI6oaJ8rMt5yoh6abICgBz1OeXHm/K95v9ZSwLoE23PwxrGkGb1jr//ULkHJj5VVLubF+vbHef6GojsJu4WmziokF8SprL6ZqO/g3YBubyeFNySecT3mcBPAdNJRXPse7m8O16W/+wrEJSWT9gdSN9bmIdx2jsZ+UyPahe9EaBrl5Npo+DVIMokYtg7nAZaUNXlrBaqDlugDgQ1hJ1JKrp7sL47SF11S9D/28Md4pxaRA6aL9aqfdMgwbHjYsubNzuYIjEQb+NftjwkikHeQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tMEfa-0001YC-Oh; Fri, 13 Dec 2024 18:02:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74860] [PATCH 03/10] services: log-cleanup: Rewrite as a Shepherd timer. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Fri, 13 Dec 2024 23:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74860 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74860@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 74860-submit@debbugs.gnu.org id=B74860.17341308775779 (code B ref 74860); Fri, 13 Dec 2024 23:02:02 +0000 Received: (at 74860) by debbugs.gnu.org; 13 Dec 2024 23:01:17 +0000 Received: from localhost ([127.0.0.1]:44555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tMEeq-0001V3-Sc for submit@debbugs.gnu.org; Fri, 13 Dec 2024 18:01:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33680) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tMEen-0001UN-Fa for 74860@debbugs.gnu.org; Fri, 13 Dec 2024 18:01:13 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tMEcb-0001mZ-Uw; Fri, 13 Dec 2024 17:58:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=ayNrXZNb9B0f9xIavfgpUE0NtMrhv2/ggHdcgnRLIa8=; b=TmOGmgRg9vNCK5mORad9 Lx/8QFkRIErgCdEKqdTt/orB5uDvXGru+Zi4E2kUqlFAwYci7zU2YlwDoOjKh1kU2IOhtOiHJz0SG kfxKvTFEU0eL3uv2FLXIpseMR2fmNjLy6qf4r3YmKf5a9TzbOz8B7jD7STWRyex7K1qvuXF2nIGB4 KSi44DWfKeILpDcK8smfKSRUtcR/lGpVuB/YjQ6xpTmm4vd8DPLmp5R7XNmtW5pWd39BvrKWvBa9J yLbzOqpSGFpduF/gsCJ07J2nsO9wiNi5eJk1569drjD9ntRW0OgBEsbVAEhP1k+denwWU4C7w2+a1 WZAYvWw8FCEfNw==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 13 Dec 2024 23:58:23 +0100 Message-ID: <3a485dfad94faba0205b96f0b742bea6056512a7.1734129908.git.ludo@gnu.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 5318F7E48B X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -6.27 X-Spam-Score: -6.27 X-TUID: 3frsdM+uukfR This is a semi-incompatible change: gexps previously provided in the ‘schedule’ field will no longer work. * gnu/services/admin.scm (log-cleanup-mcron-jobs): Remove. (log-cleanup-shepherd-services): New procedure. (log-cleanup-service-type): Extend SHEPHERD-ROOT-SERVICE-TYPE instead of MCRON-SERVICE-TYPE. * doc/guix.texi (Log Rotation): Adjust ‘schedule’ documentation accordingly. Change-Id: I2a3beb7dffbc9992b714a29423674db9c7dc6cab --- doc/guix.texi | 5 +++-- gnu/services/admin.scm | 25 +++++++++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 89a85961ac..e7784404d6 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -20973,8 +20973,9 @@ Log Rotation default). @item @code{schedule} (default: @code{"30 12 01,08,15,22 * *"}) -String or gexp denoting the corresponding mcron job schedule -(@pxref{Scheduled Job Execution}). +This is the schedule of the log cleanup job written either a string in +traditional cron syntax or as a gexp representing a Shepherd calendar +event (@pxref{Timers,,, shepherd, The GNU Shepherd Manual}). @end table @end deftp diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index 5e1c197d78..aa1f56e90a 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -349,18 +349,31 @@ (define (log-cleanup-program directory expiry) (length logs) #$directory) (for-each delete-file logs)))))) -(define (log-cleanup-mcron-jobs configuration) +(define (log-cleanup-shepherd-services configuration) (match-record configuration - (directory expiry schedule) - (list #~(job #$schedule - #$(log-cleanup-program directory expiry))))) + (directory expiry schedule) + (let ((program (log-cleanup-program directory expiry))) + (list (shepherd-service + (provision '(log-cleanup)) + (requirement '(user-processes)) + (modules '((shepherd service timer))) + (start #~(make-timer-constructor + #$(if (string? schedule) + #~(cron-string->calendar-event #$schedule) + schedule) + (command '(#$program)))) + (stop #~(make-timer-destructor)) + (actions (list (shepherd-action + (name 'trigger) + (documentation "Trigger log cleanup.") + (procedure #~trigger-timer))))))))) (define log-cleanup-service-type (service-type (name 'log-cleanup) (extensions - (list (service-extension mcron-service-type - log-cleanup-mcron-jobs))) + (list (service-extension shepherd-root-service-type + log-cleanup-shepherd-services))) (description "Periodically delete old log files."))) -- 2.46.0