(define-module (awb99 services cron2) #:export (cronservice2)) ; https://www.gnu.org/software/mcron/manual/mcron.html#Guile-Simple-Examples ; https://www.gnu.org/software/mcron/manual/html_node/The-job_002dspecifier-module.html#The-job_002dspecifier-module ; https://www.gnu.org/software/mcron/manual/mcron.html#Guile-Simple-Examples ; https://guix.gnu.org/manual/en/html_node/Scheduled-Job-Execution.html ; https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/guile-xyz.scm#n2552 (use-modules ;(guix) (gnu) (gnu services mcron) (mcron scripts mcron) (mcron base) (mcron config) (mcron job-specifier) ; For user/system files. (mcron utils) (mcron vixie-specification) (mcron core) ;(mcron) ; (shepherd service) (oop goops) ;; Defining classes and methods. (shepherd) (shepherd config) (shepherd support) (shepherd service) (shepherd system) (shepherd args) (shepherd comm) ) (use-service-modules mcron) ;(use-package-modules ;base idutils ; mcron ;) ;(define hello-job ; #~(job '(next-minute '(1)) ; (lambda () ; (execl "echo" ; "hello > /tmp/hello.txt")))) (define hello-job1 (job '(next-hour '(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23)) "echo `date` >> /tmp/d.txt")) (define guix-reconfigure-job ;; gc (remove packages older than 2 months, keep at least 500G free), pull and update every day at 03:05 #~(job "5 3 * * *" ;Vixie cron syntax "guix gc --optimize -d 2m && guix gc -F 300G && guix pull")) ; && guix system reconfigure -k /etc/config.scm ;(operating-system ;; … ; (services (cons (service mcron-service-type ; (mcron-configuration ; (jobs (list hello-job ; )))) ; %base-services))) (define cronservice2 (service mcron-service-type (mcron-configuration (jobs (list ; hello-job1 guix-reconfigure-job ))))) ;(register-services hello-job1) ; (add-job hello-job1) ;(start mycron1) ;(display "\ncrone setup.\n") ;(display hello-job1) ;(start hello-job1) ;(display "\n now showing service: ") ;(display cronservice)