mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00: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:
parent
6de8771a14
commit
aed019b646
4 changed files with 13 additions and 14 deletions
|
@ -52,7 +52,8 @@
|
||||||
shepherd-service-modules
|
shepherd-service-modules
|
||||||
|
|
||||||
shepherd-action
|
shepherd-action
|
||||||
shepherd-configuration-action))
|
shepherd-configuration-action
|
||||||
|
shepherd-trigger-action))
|
||||||
|
|
||||||
(define-record-type* <home-shepherd-configuration>
|
(define-record-type* <home-shepherd-configuration>
|
||||||
home-shepherd-configuration make-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)
|
schedule)
|
||||||
(command '(#$program))))
|
(command '(#$program))))
|
||||||
(stop #~(make-timer-destructor))
|
(stop #~(make-timer-destructor))
|
||||||
(actions (list (shepherd-action
|
(actions (list shepherd-trigger-action))
|
||||||
(name 'trigger)
|
|
||||||
(documentation "Trigger log cleanup.")
|
|
||||||
(procedure #~trigger-timer))))
|
|
||||||
(documentation "Periodically delete old log files."))))))
|
(documentation "Periodically delete old log files."))))))
|
||||||
|
|
||||||
(define log-cleanup-service-type
|
(define log-cleanup-service-type
|
||||||
|
@ -671,10 +668,7 @@ which lets you search for packages that provide a given file.")
|
||||||
;; again.
|
;; again.
|
||||||
#:wait-for-termination? #t))
|
#:wait-for-termination? #t))
|
||||||
(stop #~(make-timer-destructor))
|
(stop #~(make-timer-destructor))
|
||||||
(actions (list (shepherd-action
|
(actions (list shepherd-trigger-action)))))
|
||||||
(name 'trigger)
|
|
||||||
(documentation "Trigger unattended system upgrade.")
|
|
||||||
(procedure #~trigger-timer)))))))
|
|
||||||
|
|
||||||
(define unattended-upgrade-service-type
|
(define unattended-upgrade-service-type
|
||||||
(service-type
|
(service-type
|
||||||
|
|
|
@ -255,11 +255,7 @@ command-line arguments to the current job @command{restic backup} invocation."))
|
||||||
max-duration)))
|
max-duration)))
|
||||||
(stop
|
(stop
|
||||||
#~(make-timer-destructor))
|
#~(make-timer-destructor))
|
||||||
(actions (list (shepherd-action
|
(actions (list shepherd-trigger-action)))))
|
||||||
(name 'trigger)
|
|
||||||
(documentation "Manually trigger a backup,
|
|
||||||
without waiting for the scheduled time.")
|
|
||||||
(procedure #~trigger-timer)))))))
|
|
||||||
|
|
||||||
(define (restic-guix-wrapper-package jobs)
|
(define (restic-guix-wrapper-package jobs)
|
||||||
(package
|
(package
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
shepherd-action-procedure
|
shepherd-action-procedure
|
||||||
|
|
||||||
shepherd-configuration-action
|
shepherd-configuration-action
|
||||||
|
shepherd-trigger-action
|
||||||
|
|
||||||
%default-modules
|
%default-modules
|
||||||
|
|
||||||
|
@ -404,6 +405,13 @@ of the service's configuration file."
|
||||||
(format #t "~a~%" #$file)
|
(format #t "~a~%" #$file)
|
||||||
#$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)
|
(define (shepherd-configuration-file services shepherd)
|
||||||
"Return the shepherd configuration file for SERVICES. SHEPHERD is used
|
"Return the shepherd configuration file for SERVICES. SHEPHERD is used
|
||||||
as shepherd package."
|
as shepherd package."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue