From patchwork Sat Mar 22 11:36:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40585 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1130027BBEA; Sat, 22 Mar 2025 11:38:33 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 75C1D27BBE2 for ; Sat, 22 Mar 2025 11:38:32 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxB9-0001q1-Bb; Sat, 22 Mar 2025 07:38:16 -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 ) id 1tvxAx-0001ks-Uc for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:05 -0400 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 1tvxAw-000062-PH; Sat, 22 Mar 2025 07:38:02 -0400 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=kKFwC/YhTb7T7zwFlaAjiepVG764iIJVG4MkOXfEuV8=; b=F+WwcK7RA3ktHib+2nJdTRo9ELarqmLPfTAYDmFx6rwuwAdRwsjyvJ4WltcohzNp+MPafVyjYMvhS02fsQTtobEfE8mEDOggUI+5CmCvqeKjS+Mdb0YJtTqR5UWzrx+YUO25u3nAJYb6ZdGqRkCOVNBv4ze720i0RoDgffhyCWbfivGSYn/nYPOnL57q1zehComutegrnbBgM0mSiRndvnruDeQoJWMqq8otzQxH8nWFfkDKyPoGPGNMojJINPSxxgGmOUpdHVcRMw6bion8A+vX0Ua0dWJSRUtP0XHMP+igVL2oMPL6vfMOe7APKKV5z5mm1Kaqcs26QJHddreCmw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxAw-0002YB-5y; Sat, 22 Mar 2025 07:38:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 01/16] services: shepherd: Factorize =?utf-8?b?4oCYdHJpZ2dlcuKAmQ==?= action. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: andrew@trop.in, janneke@gnu.org, ludo@gnu.org, tanguy@bioneland.org, guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Andrew Tropin , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour X-Debbugs-Original-Xcc: Andrew Tropin , Janneke Nieuwenhuizen , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434479574 (code B ref 77041); Sat, 22 Mar 2025 11:38:02 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:27 +0000 Received: from localhost ([127.0.0.1]:41149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAM-0002UL-Sv for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33524) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAF-0002TS-S5 for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:20 -0400 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 1tvxAA-0008Sv-Cz; Sat, 22 Mar 2025 07:37:14 -0400 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=kKFwC/YhTb7T7zwFlaAjiepVG764iIJVG4MkOXfEuV8=; b=FZhOE8tjeGKfyiyEx2Sc tDHiLTf4m+W5B4kNQNIQhEU1wt8p7GF+GYVQFGQmjq3Uru28xsGQ1TfwyD6xdRb1BXLzHUCGTiukQ tqyevyuhjuvI/+6FWe9aB6HOJ7ogdrC6M1BQnWQ9BBapS+tHnX6TsMuyVClH7nwzvtwECKJ9nBjCB qO3sBQ/d3K58a5i9bnmt3B9MzN37T/LEtcJojDL/H4mHOkP9diCuUoSyWAzi1lPXZyzpNaQ1X85hQ KtZsn019cIqRM5yTzCdkMFJVev1NOw49y+iKpZKxcfGuDdBQ5ybTw8cIVgn2H4RU1xV9SaDfC4DG+ 64yzxhHjEbf4bQ==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:38 +0100 Message-ID: <3aa2a59b21ca35f4821768248914c85f77ab4868.1742642743.git.ludo@gnu.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/shepherd.scm (shepherd-trigger-action): New variable. * gnu/services/admin.scm (log-cleanup-shepherd-services) (unattended-upgrade-shepherd-services): Use it. * gnu/services/backup.scm (restic-backup-job->shepherd-service): Use it. * gnu/home/services/shepherd.scm: Re-export ‘shepherd-trigger-action’. Change-Id: I834b5b9b61c78f012ee9306df6cf4fd8a93dd6d2 --- gnu/home/services/shepherd.scm | 3 ++- gnu/services/admin.scm | 10 ++-------- gnu/services/backup.scm | 6 +----- gnu/services/shepherd.scm | 8 ++++++++ 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/gnu/home/services/shepherd.scm b/gnu/home/services/shepherd.scm index b2b141d4de..25f1641b32 100644 --- a/gnu/home/services/shepherd.scm +++ b/gnu/home/services/shepherd.scm @@ -52,7 +52,8 @@ (define-module (gnu home services shepherd) shepherd-service-modules shepherd-action - shepherd-configuration-action)) + shepherd-configuration-action + shepherd-trigger-action)) (define-record-type* home-shepherd-configuration make-home-shepherd-configuration diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index 2a11a4f4f1..726ca5f918 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -404,10 +404,7 @@ (define (log-cleanup-shepherd-services configuration) schedule) (command '(#$program)))) (stop #~(make-timer-destructor)) - (actions (list (shepherd-action - (name 'trigger) - (documentation "Trigger log cleanup.") - (procedure #~trigger-timer)))) + (actions (list shepherd-trigger-action)) (documentation "Periodically delete old log files.")))))) (define log-cleanup-service-type @@ -671,10 +668,7 @@ (define (unattended-upgrade-shepherd-services config) ;; again. #:wait-for-termination? #t)) (stop #~(make-timer-destructor)) - (actions (list (shepherd-action - (name 'trigger) - (documentation "Trigger unattended system upgrade.") - (procedure #~trigger-timer))))))) + (actions (list shepherd-trigger-action))))) (define unattended-upgrade-service-type (service-type diff --git a/gnu/services/backup.scm b/gnu/services/backup.scm index 4d8cf167f0..6e066bd3d6 100644 --- a/gnu/services/backup.scm +++ b/gnu/services/backup.scm @@ -255,11 +255,7 @@ (define (restic-backup-job->shepherd-service config) max-duration))) (stop #~(make-timer-destructor)) - (actions (list (shepherd-action - (name 'trigger) - (documentation "Manually trigger a backup, -without waiting for the scheduled time.") - (procedure #~trigger-timer))))))) + (actions (list shepherd-trigger-action))))) (define (restic-guix-wrapper-package jobs) (package diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm index 65c49b9c59..e7e414b920 100644 --- a/gnu/services/shepherd.scm +++ b/gnu/services/shepherd.scm @@ -72,6 +72,7 @@ (define-module (gnu services shepherd) shepherd-action-procedure shepherd-configuration-action + shepherd-trigger-action %default-modules @@ -404,6 +405,13 @@ (define (shepherd-configuration-action file) (format #t "~a~%" #$file) #$file)))) +(define shepherd-trigger-action + ;; Action to trigger a timer. + (shepherd-action + (name 'trigger) + (documentation "Trigger immediate execution of this timer.") + (procedure #~trigger-timer))) + (define (shepherd-configuration-file services shepherd) "Return the shepherd configuration file for SERVICES. SHEPHERD is used as shepherd package."