From patchwork Fri Jan 24 23:01:45 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: 37701 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 A2B0127BBEA; Fri, 24 Jan 2025 23:02:26 +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 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 B883C27BBE2 for ; Fri, 24 Jan 2025 23:02:25 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tbSgf-00051r-Q9; Fri, 24 Jan 2025 18:02:05 -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 1tbSgc-00051M-Qk for guix-patches@gnu.org; Fri, 24 Jan 2025 18:02:03 -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 1tbSgc-0006rH-Hz for guix-patches@gnu.org; Fri, 24 Jan 2025 18:02:02 -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:Date:References:In-Reply-To:From:To:Subject; bh=i8IboycKb6LtY1vQFDNXj8n/E4FDco2Rg17/aneZSZ4=; b=WmGK90/E9fwktBzG0KCgdwIOcCmXM9pKFs0d4Vgu45sAWVcjEemUV3EI6w7SqKlRw3ixZX37qfi+Qj+UN2NfY2RNjXT3HXcEB4r9tAbZZoKpeDj9euFgxcm/uQ6GtjTfYnrH3dT87FUjxw0IH4e5cItuVdiLn6F+wSkL0g/X20enfiHyH5/yM0SLEiUXAZn5fsJhXh4xVpYRJGCj6yrJHYS4ha2ur9Jj7vlpXZvXai0sLheUti60PFs65iI5dHEanyJFXpW6Y7QLy5GX4MLHD5I7I6AbJDcgC49QJVeeg+qGOTBnGuQv0BAwkYvHG1jsrXypcXFA9EWW6IQ1AWE5Mg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tbSgc-0000WG-CY for guix-patches@gnu.org; Fri, 24 Jan 2025 18:02:02 -0500 Subject: bug#75045: [PATCH v2] services: restic-backup: Implement as a Shepherd timer. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Fri, 24 Jan 2025 23:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 75045 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Giacomo Leidi Cc: Maxim Cournoyer , 75045-done@debbugs.gnu.org Mail-Followup-To: 75045@debbugs.gnu.org, ludo@gnu.org, goodoldpaul@autistici.org Received: via spool by 75045-done@debbugs.gnu.org id=D75045.17377597171980 (code D ref 75045); Fri, 24 Jan 2025 23:02:02 +0000 Received: (at 75045-done) by debbugs.gnu.org; 24 Jan 2025 23:01:57 +0000 Received: from localhost ([127.0.0.1]:47417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tbSgX-0000Vr-AM for submit@debbugs.gnu.org; Fri, 24 Jan 2025 18:01:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37420) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tbSgV-0000VZ-6G for 75045-done@debbugs.gnu.org; Fri, 24 Jan 2025 18:01:55 -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 1tbSgO-0006qo-KQ; Fri, 24 Jan 2025 18:01:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=i8IboycKb6LtY1vQFDNXj8n/E4FDco2Rg17/aneZSZ4=; b=gSw8wdaXl6WPYPN0lXUX OfJH3xp/Dj4nNCOQoRpdBfLX5Tbc4xsPwvMfxeR0ZSMy1YN9R4cU+X/okgpbnhiDFgOLxiFOU0A/A rvJsv0HX9Pk0J2xwZoLlT5YpuHL0njWMo9ljUPfGmTyAPmqM4ms77ub4ArO91xBb8XVhQbLvKXDF0 XK17ZKKvs2ZwoYUXC1xMs8nLshKESyMhDiIwAn/ZkWKFUeNEOu9iLUvc44RzQC2IlHe2CCkepn9L5 TOcUGlZJhpYvyCVV44xqYWXCJ69UB6dRl3hQfxHK+dLDc4TaHfphoXDSO6AXj6TsAnZwqPs75kuFZ AZSTJWVsGQKhjg==; From: Ludovic =?utf-8?q?Court=C3=A8s?= In-Reply-To: <9b62d9a0cd9f00b074a5871729286925788a0eab.1737324240.git.goodoldpaul@autistici.org> (Giacomo Leidi's message of "Sun, 19 Jan 2025 23:04:00 +0100") References: <9b62d9a0cd9f00b074a5871729286925788a0eab.1737324240.git.goodoldpaul@autistici.org> Date: Sat, 25 Jan 2025 00:01:45 +0100 Message-ID: <875xm3ddeu.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) 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 Giacomo Leidi skribis: > This patch implements restic backup with Shepherd services. It is > supposed not to break any existing setup. > > * gnu/services/backup.scm (restic-backup-job): Add Shepherd > configuration options; > (restic-backup-job->mcron-job): Replace with...; > (restic-job-log-file): New procedure; > (restic-backup-job->shepherd-service): New procedure; > (restic-backup-activation): New procedure; > (restic-backup-service-type): Replace mcron with Shepherd extension and add > activation extension hook. > * doc/guix.texi: Document it. > > Change-Id: I66de3b6a1cb6177f9e4ee0c2acf3013ecbcdd338 Applied with the cosmetic change below, thanks! I just realized there’s no test for this service, so let’s everything still works well. Would be nice to add a test. > + ;; We go through bash, instead of executing > + ;; restic-guix directly, because the login shell > + ;; gives us the correct user environment that some > + ;; backends require, such as rclone. > + (string-append #+bash-minimal "/bin/bash") > + "-l" "-c" > + (string-append "restic-guix backup " #$name)) Thanks for adding this comment. Ludo’. diff --git a/doc/guix.texi b/doc/guix.texi index d18209f288..9a53bdcd37 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -42755,7 +42755,7 @@ Miscellaneous Services @item @code{log-file} (type: maybe-string) The file system path to the log file for this job. By default the file will -have be @file{/var/log/restic-backup/JOB-NAME.log}, where @code{JOB-NAME} is the +have be @file{/var/log/restic-backup/@var{job-name}.log}, where @var{job-name} is the name defined in the @code{name} field. @item @code{max-duration} (type: maybe-number) diff --git a/gnu/services/backup.scm b/gnu/services/backup.scm index 3dda6ca370..6cada58b10 100644 --- a/gnu/services/backup.scm +++ b/gnu/services/backup.scm @@ -89,7 +89,7 @@ (define-configuration/no-serialization restic-backup-job (log-file (maybe-string) "The file system path to the log file for this job. By default the file will -have be @file{/var/log/restic-backup/JOB-NAME.log}, where @code{JOB-NAME} is the +have be @file{/var/log/restic-backup/@var{job-name}.log}, where @var{job-name} is the name defined in the @code{name} field.") (max-duration (maybe-number) @@ -316,5 +316,5 @@ (define restic-backup-service-type jobs))))) (default-value (restic-backup-configuration)) (description - "This service configures @code{Shepherd} timers for running backups + "This service configures Shepherd timers for running backups with restic.")))