bug#75045: [PATCH v2] services: restic-backup: Implement as a Shepherd timer.

Message ID 875xm3ddeu.fsf@gnu.org
State New
Headers
Series bug#75045: [PATCH v2] services: restic-backup: Implement as a Shepherd timer. |

Commit Message

Ludovic Courtès Jan. 24, 2025, 11:01 p.m. UTC
  Giacomo Leidi <goodoldpaul@autistici.org> 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’.
  

Patch

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.")))