2021-09-10 06:26:33 +00:00
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
2023-03-05 15:19:14 +00:00
|
|
|
;;; Copyright © 2021, 2023 Andrew Tropin <andrew@trop.in>
|
2021-09-10 06:26:33 +00:00
|
|
|
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
|
2022-11-17 04:09:17 +00:00
|
|
|
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
2023-08-06 16:59:15 +00:00
|
|
|
;;; Copyright © 2023 Ludovic Courtès <ludo@gnu.org>
|
2021-09-10 06:26:33 +00:00
|
|
|
;;;
|
|
|
|
;;; This file is part of GNU Guix.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
|
|
;;; under the terms of the GNU General Public License as published by
|
|
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
;;; your option) any later version.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;;; GNU General Public License for more details.
|
|
|
|
;;;
|
|
|
|
;;; You should have received a copy of the GNU General Public License
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2021-10-04 23:09:41 +00:00
|
|
|
(define-module (gnu home services mcron)
|
2021-10-09 13:51:25 +00:00
|
|
|
#:use-module (gnu home services)
|
2021-10-04 23:09:41 +00:00
|
|
|
#:use-module (gnu home services shepherd)
|
2023-08-06 16:59:15 +00:00
|
|
|
#:use-module (gnu services mcron) ;for the service mapping
|
2021-09-10 06:26:33 +00:00
|
|
|
#:export (home-mcron-configuration
|
|
|
|
home-mcron-service-type))
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;;
|
|
|
|
;; Service for the GNU mcron cron job manager.
|
|
|
|
;;
|
|
|
|
;; Example configuration, the first job runs mbsync once every ten
|
|
|
|
;; minutes, the second one writes "Mcron service" to ~/mcron-file once
|
|
|
|
;; every minute.
|
|
|
|
;;
|
|
|
|
;; (service home-mcron-service-type
|
|
|
|
;; (home-mcron-configuration
|
|
|
|
;; (jobs (list #~(job '(next-minute
|
|
|
|
;; (range 0 60 10))
|
|
|
|
;; (lambda ()
|
|
|
|
;; (system* "mbsync" "--all")))
|
|
|
|
;; #~(job next-minute-from
|
|
|
|
;; (lambda ()
|
|
|
|
;; (call-with-output-file (string-append (getenv "HOME")
|
|
|
|
;; "/mcron-file")
|
|
|
|
;; (lambda (port)
|
|
|
|
;; (display "Mcron service" port)))))))))
|
|
|
|
;;
|
|
|
|
;;; Code:
|
|
|
|
|
2023-08-06 16:59:15 +00:00
|
|
|
(define-syntax-rule (home-mcron-configuration fields ...)
|
|
|
|
;; Macro provided for backward compatibility.
|
|
|
|
(for-home (mcron-configuration fields ...)))
|
2021-09-10 06:26:33 +00:00
|
|
|
|
|
|
|
(define home-mcron-service-type
|
2023-08-06 16:59:15 +00:00
|
|
|
(service-type
|
|
|
|
(inherit (system->home-service-type mcron-service-type))
|
|
|
|
(default-value (for-home (mcron-configuration)))))
|
2022-11-17 04:09:17 +00:00
|
|
|
|
2023-08-06 16:59:15 +00:00
|
|
|
(define-service-type-mapping
|
|
|
|
mcron-service-type => home-mcron-service-type)
|
2022-11-17 04:09:17 +00:00
|
|
|
|
|
|
|
;;; mcron.scm ends here
|