[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#77041] [PATCH v2 02/16] services: file-database: Turn into a Shephe
From: |
Ludovic Courtès |
Subject: |
[bug#77041] [PATCH v2 02/16] services: file-database: Turn into a Shepherd timer. |
Date: |
Sat, 22 Mar 2025 12:36:39 +0100 |
* gnu/services/admin.scm (file-database-mcron-jobs): Rename to…
(file-database-shepherd-services): … this. Return a list of Shepherd
services.
(file-database-service-type): Adjust accordingly.
* doc/guix.texi (File Search Services): Update documentation of
‘schedule’.
Change-Id: I5734c629b113e54057694d2ec480abd26b7815db
---
doc/guix.texi | 5 +++--
gnu/services/admin.scm | 22 ++++++++++++++++++----
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 0adc6f8c65..9e3b452577 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -27162,8 +27162,9 @@ File Search Services
is taken.
@item @code{schedule} (default: @code{%default-file-database-update-schedule})
-String or G-exp denoting an mcron schedule for the periodic
-@command{updatedb} job (@pxref{Guile Syntax,,, mcron, GNU@tie{}mcron}).
+This is the schedule of database updates, expressed as a string in
+traditional cron syntax or as a gexp evaluating to a Shepherd calendar
+event (@pxref{Timers,,, shepherd, The GNU Shepherd Manual}).
@item @code{excluded-directories} (default
@code{%default-file-database-excluded-directories})
List of regular expressions of directories to ignore when building the
diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm
index 726ca5f918..5f5b76ffbb 100644
--- a/gnu/services/admin.scm
+++ b/gnu/services/admin.scm
@@ -462,7 +462,7 @@ (define-configuration/no-serialization
file-database-configuration
guix locate}). This list is passed to the @option{--prunepaths} option of
@command{updatedb} (@pxref{Invoking updatedb,,, find, GNU@tie{}Findutils})."))
-(define (file-database-mcron-jobs configuration)
+(define (file-database-shepherd-services configuration)
(match-record configuration <file-database-configuration>
(package schedule excluded-directories)
(let ((updatedb (program-file
@@ -481,13 +481,27 @@ (define (file-database-mcron-jobs configuration)
#$(string-append "--prunepaths="
(string-join
excluded-directories)))))))
- (list #~(job #$schedule #$updatedb)))))
+ (list (shepherd-service
+ (provision '(file-database-update))
+ (requirement '(user-processes))
+ (modules '((shepherd service timer)))
+ (start #~(make-timer-constructor
+ #$(if (string? schedule)
+ #~(cron-string->calendar-event #$schedule)
+ schedule)
+ (command '(#$updatedb))
+ #:wait-for-termination? #t))
+ (stop #~(make-timer-destructor))
+ (documentation
+ "Periodically update the system-wide file database that can be
+queried by the 'locate' command.")
+ (actions (list shepherd-trigger-action)))))))
(define file-database-service-type
(service-type
(name 'file-database)
- (extensions (list (service-extension mcron-service-type
- file-database-mcron-jobs)))
+ (extensions (list (service-extension shepherd-root-service-type
+ file-database-shepherd-services)))
(description
"Periodically update the file database used by the @command{locate}
command,
which lets you search for files by name. The database is created by running
--
2.48.1
[bug#77041] [PATCH 00/16] Replacing mcron jobs by Shepherd timers, Maxim Cournoyer, 2025/03/16
[bug#77041] [PATCH 00/16] Replacing mcron jobs by Shepherd timers, Sergey Trofimov, 2025/03/17
[bug#77041] [PATCH v2 00/16] Replacing mcron jobs by Shepherd timers, Ludovic Courtès, 2025/03/22
[bug#77041] [PATCH v2 10/16] tests: ganeti: Write system log to /dev/console., Ludovic Courtès, 2025/03/22
[bug#77041] [PATCH v2 01/16] services: shepherd: Factorize ‘trigger’ action., Ludovic Courtès, 2025/03/22
[bug#77041] [PATCH v2 07/16] services: wireguard: Turn monitoring into a Shepherd timer., Ludovic Courtès, 2025/03/22
[bug#77041] [PATCH v2 04/16] services: package-database: Turn into a Shepherd timer., Ludovic Courtès, 2025/03/22
[bug#77041] [PATCH v2 09/16] tests: ganeti: Remove unnecessary ‘begin’., Ludovic Courtès, 2025/03/22
[bug#77041] [PATCH v2 11/16] tests: ganeti: Increase VM memory size., Ludovic Courtès, 2025/03/22