mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
services: shepherd: Factorize ‘trigger’ action.
* 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’. Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Change-Id: I834b5b9b61c78f012ee9306df6cf4fd8a93dd6d2
This commit is contained in:
@@ -52,7 +52,8 @@
|
||||
shepherd-service-modules
|
||||
|
||||
shepherd-action
|
||||
shepherd-configuration-action))
|
||||
shepherd-configuration-action
|
||||
shepherd-trigger-action))
|
||||
|
||||
(define-record-type* <home-shepherd-configuration>
|
||||
home-shepherd-configuration make-home-shepherd-configuration
|
||||
|
||||
@@ -404,10 +404,7 @@ This service is deprecated and slated for removal after 2025-06-15.")
|
||||
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 @@ which lets you search for packages that provide a given file.")
|
||||
;; 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
|
||||
|
||||
@@ -255,11 +255,7 @@ command-line arguments to the current job @command{restic backup} invocation."))
|
||||
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
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
shepherd-action-procedure
|
||||
|
||||
shepherd-configuration-action
|
||||
shepherd-trigger-action
|
||||
|
||||
%default-modules
|
||||
|
||||
@@ -404,6 +405,13 @@ of the service's configuration 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."
|
||||
|
||||
Reference in New Issue
Block a user