mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
services: mcron: Use match-record.
* gnu/services/mcron.scm (mcron-shepherd-services): Use match-record. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
parent
6f4fd8f5b8
commit
edb398449f
1 changed files with 31 additions and 33 deletions
|
@ -143,41 +143,39 @@ (define (shepherd-schedule-action mcron files)
|
||||||
(display line)
|
(display line)
|
||||||
(loop)))))))))
|
(loop)))))))))
|
||||||
|
|
||||||
(define mcron-shepherd-services
|
(define (mcron-shepherd-services config)
|
||||||
(match-lambda
|
(match-record config <mcron-configuration> (mcron jobs log? log-format)
|
||||||
(($ <mcron-configuration> mcron ()) ;nothing to do!
|
(if (eq? jobs '())
|
||||||
'())
|
'() ; nothing to do
|
||||||
(($ <mcron-configuration> mcron jobs log? log-format)
|
(let ((files (job-files mcron jobs)))
|
||||||
(let ((files (job-files mcron jobs)))
|
(list (shepherd-service
|
||||||
(list (shepherd-service
|
(provision '(mcron))
|
||||||
(provision '(mcron))
|
(requirement '(user-processes))
|
||||||
(requirement '(user-processes))
|
(modules `((srfi srfi-1)
|
||||||
(modules `((srfi srfi-1)
|
(srfi srfi-26)
|
||||||
(srfi srfi-26)
|
(ice-9 popen) ;for the 'schedule' action
|
||||||
(ice-9 popen) ;for the 'schedule' action
|
(ice-9 rdelim)
|
||||||
(ice-9 rdelim)
|
(ice-9 match)
|
||||||
(ice-9 match)
|
,@%default-modules))
|
||||||
,@%default-modules))
|
(start #~(make-forkexec-constructor
|
||||||
(start #~(make-forkexec-constructor
|
(list (string-append #$mcron "/bin/mcron")
|
||||||
(list (string-append #$mcron "/bin/mcron")
|
#$@(if log?
|
||||||
#$@(if log?
|
#~("--log" "--log-format" #$log-format)
|
||||||
#~("--log" "--log-format" #$log-format)
|
#~())
|
||||||
#~())
|
#$@files)
|
||||||
#$@files)
|
|
||||||
|
|
||||||
;; Disable auto-compilation of the job files and set a
|
;; Disable auto-compilation of the job files and
|
||||||
;; sane value for 'PATH'.
|
;; set a sane value for 'PATH'.
|
||||||
#:environment-variables
|
#:environment-variables
|
||||||
(cons* "GUILE_AUTO_COMPILE=0"
|
(cons* "GUILE_AUTO_COMPILE=0"
|
||||||
"PATH=/run/current-system/profile/bin"
|
"PATH=/run/current-system/profile/bin"
|
||||||
(remove (cut string-prefix? "PATH=" <>)
|
(remove (cut string-prefix? "PATH=" <>)
|
||||||
(environ)))
|
(environ)))
|
||||||
|
|
||||||
#:log-file "/var/log/mcron.log"))
|
#:log-file "/var/log/mcron.log"))
|
||||||
(stop #~(make-kill-destructor))
|
(stop #~(make-kill-destructor))
|
||||||
|
(actions
|
||||||
(actions
|
(list (shepherd-schedule-action mcron files)))))))))
|
||||||
(list (shepherd-schedule-action mcron files)))))))))
|
|
||||||
|
|
||||||
(define mcron-service-type
|
(define mcron-service-type
|
||||||
(service-type (name 'mcron)
|
(service-type (name 'mcron)
|
||||||
|
|
Loading…
Reference in a new issue