From patchwork Sat Mar 15 21:37:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40216 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 4DB6B27BBE9; Sat, 15 Mar 2025 21:38:20 +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=unavailable 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 33D2627BBE2 for ; Sat, 15 Mar 2025 21:38:18 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ttZCo-0004iB-9D; Sat, 15 Mar 2025 17:38:06 -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 1ttZCk-0004hs-PK for guix-patches@gnu.org; Sat, 15 Mar 2025 17:38:02 -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 1ttZCk-0002hT-F1 for guix-patches@gnu.org; Sat, 15 Mar 2025 17: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=FbUeOlvz3y9CaSJr/qoT34k83YuGWxyvCpr7QLU5eMQ=; b=ADvYeS1LWeO8gmeVzIlU4i9r5yCm7FTP5TMLjJdOOPCT+/Hby0iBsjVbGVGGVwPuD+ufbw/csKlYb9UvvQgyZ1LtpGNr0MgU3XB1bGPmqmhYN+kHe2lFAm2usfkdmRHayLYSrygPI+wOOuRBSuJZZsCMpioevwny9IMQEA/RHjRgskdEN9uHYJ20WsekezooBXWWzsjWWbizMWFSwHJomExO9C4rao16PuxijZHpo5H0gwwGfK/4Vfgm9Sm93HGz5CDh8B+Xz2VTA8tQdoMCx6zfHATo9CxdfapOGa+lWCObrJIXiodPLcHfPi+r+FGOJqGAIeUrXDip0DDfadbHGQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ttZCk-0004N4-83 for guix-patches@gnu.org; Sat, 15 Mar 2025 17:38:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH 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: guix-patches@gnu.org Resent-Date: Sat, 15 Mar 2025 21: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?= Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.174207468016773 (code B ref 77041); Sat, 15 Mar 2025 21:38:02 +0000 Received: (at 77041) by debbugs.gnu.org; 15 Mar 2025 21:38:00 +0000 Received: from localhost ([127.0.0.1]:43812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ttZCi-0004MS-6O for submit@debbugs.gnu.org; Sat, 15 Mar 2025 17:38:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53234) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ttZCf-0004LH-1L for 77041@debbugs.gnu.org; Sat, 15 Mar 2025 17:37:58 -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 1ttZCZ-0002fi-GQ; Sat, 15 Mar 2025 17:37:51 -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=FbUeOlvz3y9CaSJr/qoT34k83YuGWxyvCpr7QLU5eMQ=; b=r8klLKIXG8zokZ3fXgMt UNGOfVq0cEoLINCd+LsGSCGnoPctBcOHMxl1gmXTcP+bF88yunXfzK9GItQyl1t2Lolv0KqDJm8uF OwmTZKx4r98K1Sr5N6pmop+Qrg8VEDTJCDrc7uUqAYkhifPhn5duktpA3p+jifdZjM4QhnyAehe8F S4v7XNCJFQPFSogDoFqp7E0xkAIn8AaEgOhicDEif8BPpSWZLX+G3tOlhsoZskGOo8i6s4FuoLXhh gJO/qPBzAWnncQOVuqCK/yofInXt9HZin4fLMMpI4hRsPGAXIIDthUIeARZZ11tSOlydJBW90iIKL zcX9izkjUfOCAw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 15 Mar 2025 22:37:07 +0100 Message-ID: <8849153c52dfe2ceec61a2cdbf3c07cb3363ff7d.1742073920.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. Change-Id: I834b5b9b61c78f012ee9306df6cf4fd8a93dd6d2 --- gnu/services/admin.scm | 10 ++-------- gnu/services/backup.scm | 6 +----- gnu/services/shepherd.scm | 8 ++++++++ 3 files changed, 11 insertions(+), 13 deletions(-) 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."