From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id AKJzEgj0fmfL0wAAqHPOHw:P1 (envelope-from ) for ; Wed, 08 Jan 2025 21:54:16 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id AKJzEgj0fmfL0wAAqHPOHw (envelope-from ) for ; Wed, 08 Jan 2025 22:54:16 +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=vktHOrUF; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=CYrighEu; 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"; 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=1736373256; 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=Ybuk2RetGYS+YVsBjWOX8n0lzltYgSskKRb1HStkWyo=; b=oydYK0fO/hzcKWgvU4Idn9GfxY++76wE2QwW55Xr351qfBO7qvgeqsOjww5+LfpEisMBVV mh1HGe3kmAT36LRojf0R09nzT7B5K5glLYEj7tQidfQnGpjKSzYjBoSwHCT90XyYPwRgbm 0wwKT8xj5v1qHZEHTmKS4jPIPx+TFfBOmHbSHTqrK6Yt/CMWoNiwFYkmE8CQ9t7s5CA3Px Mbe8Vm+1NVxZMOKYlFFjl20DJ8YrHO3VG8XzXX71sa6Vw0lFY9ppw4t15m3l/zVBi1cUGu 3Ej4GgiGgMIC5JjO5CUwprql34kDNMQWEbEs8yl34jlwohMCjNfvqSdlqPan+A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=vktHOrUF; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=CYrighEu; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1736373256; a=rsa-sha256; cv=none; b=jMAJl3TH7A59wb/likpR0xX5Stljyi0gr0chb5tgxjIduEsf5VsC/boAd9UhhklyXyq6El daeGszcjCeS/Cz+WAv41LHLcUFaIzkbKVrptVsjLhVbtoPQu3eNBuwuF11W00l0lMg3RHP 6gbJvYybdxvN+XL6U5nE3bosXDdTHNBNcs6H0uDS0Zmdr9839gExf65Z5tgmNEyw2XQubp X8YfQsAvTk4glhCyshpsU+iJPgzyRxSanPtFsGlM4KNG96wWa3SbXw6RLzptHMcRBqaCyv GhjTiWkXGcks6AW4XuwYUlMHHK3Kj70C7GP8qG/a8zbwaJi7BJjvfps1KJGKUg== 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 2FC369E418 for ; Wed, 08 Jan 2025 22:54:16 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVe09-00008G-J9; Wed, 08 Jan 2025 16:54:12 -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 1tVe02-0008UR-81 for guix-patches@gnu.org; Wed, 08 Jan 2025 16:54:02 -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 1tVe01-0004Fz-Uh; Wed, 08 Jan 2025 16:54:01 -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=Ybuk2RetGYS+YVsBjWOX8n0lzltYgSskKRb1HStkWyo=; b=vktHOrUFmYU5VQn+O1oQWfz4gABB+YOWC2QmwHGnkiRsBahMJmBglNKrffh7Xg5ocgxJBHsxMyY9kDri+5w6JGS4NvFk6wONdWfe5bi3C4JbMkyLYEXQyoBleDhWIEG/BeREsILjJsoUI84bxpVieJcvBG0apvgLH7oDsxHPwwCssEvnV162BMxcB2LiomfLj4OSNJ8kyGv8iFh4s5jERcyrBKPhnOJacRYlnAg8JeT6UJHxdy0Y9i3jrlTqJL25jYZX7Yjo01uvRQVrmEQRKPIMgRD/sjvNH4eNq/Ovj7o/gMPLD/SLfTs2J3MJpaZsP7mw3vPkCEWMOzR+73IJGg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tVe01-0005XI-PM; Wed, 08 Jan 2025 16:54:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74860] [PATCH v3 04/12] 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: Wed, 08 Jan 2025 21:54:01 +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.173637318821137 (code B ref 74860); Wed, 08 Jan 2025 21:54:01 +0000 Received: (at 74860) by debbugs.gnu.org; 8 Jan 2025 21:53:08 +0000 Received: from localhost ([127.0.0.1]:49300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tVdz9-0005Ue-37 for submit@debbugs.gnu.org; Wed, 08 Jan 2025 16:53:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37976) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tVdz1-0005SZ-QL for 74860@debbugs.gnu.org; Wed, 08 Jan 2025 16:53:00 -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 1tVdyw-00045h-Hl; Wed, 08 Jan 2025 16:52:54 -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=Ybuk2RetGYS+YVsBjWOX8n0lzltYgSskKRb1HStkWyo=; b=CYrighEuEMRi+UHB3bAc +212R/pjMsbSyvQivGlqELlMAQe3zhjGLmzkuRk/PVmrF7CgR2CSIuGs/BYUB3KMh5nzXrqrt60KV BRwQQHNqx0yOL3DKZG2YpEoLd1VQt05GydBW3qkqUe57ZeumAylwF7YOVEEAZyX6VEW7xSBJCDPSx qtsI+I3Tpjqu/hleWDn9SWU1P77s4ZfWJy5tg5xp6GtiUrDjdF+9iG9zK5Oy8K2RmLzicJqnUfI2F v6oQYMw06U1bGk5Jew/GVpoxPKe0Vh5yr//3uj7Ii2uGvGBWZeS+qhbu74cf5PcjIyAX1G5lsommA JCSKAOeWJRM/zw==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Wed, 8 Jan 2025 22:51:52 +0100 Message-ID: <788340be0f08a348de1e1dcbd908019e24f465cf.1736373022.git.ludo@gnu.org> X-Mailer: git-send-email 2.47.1 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.98 X-Spam-Score: -3.98 X-Migadu-Queue-Id: 2FC369E418 X-Migadu-Scanner: mx10.migadu.com X-TUID: /zCiTYbj/AO2 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 f521a2d2ad..e1d08c2f10 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -21084,8 +21084,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}). +Schedule of the log cleanup job written either as 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 deaa3b6c89..7d202d737e 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -385,18 +385,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.47.1