guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mcron service


From: Ludovic Courtès
Subject: mcron service
Date: Thu, 23 Jun 2016 10:18:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hi!

Commit c311089b0b19f094e44d3f858c29f77d757332d1 adds ‘mcron-service’.
If you want to give it a try, your feedback is welcome!  Excerpt from
the manual below.

Ludo’.

7.2.7.2 Scheduled Job Execution
...............................

The ‘(gnu services mcron)’ module provides an interface to GNU mcron, a
daemon to run jobs at scheduled times (*note (mcron)Top::).  GNU mcron
is similar to the traditional Unix ‘cron’ daemon; the main difference is
that it is implemented in Guile Scheme, which provides a lot of
flexibility when specifying the scheduling of jobs and their actions.

   For example, to define an operating system that runs the ‘updatedb’
(*note (find)Invoking updatedb::) and the ‘guix gc’ commands (*note
Invoking guix gc::) daily:

     (use-modules (guix) (gnu) (gnu services mcron))

     (define updatedb-job
       ;; Run 'updatedb' at 3 AM every day.
       #~(job '(next-hour '(3))
              "updatedb --prunepaths='/tmp /var/tmp /gnu/store'"))

     (define garbage-collector-job
       ;; Collect garbage 5 minutes after midnight every day.
       #~(job "5 0 * * *"            ;Vixie cron syntax
              "guix gc -F 1G"))

     (operating-system
       ;; ...
       (services (cons (mcron-service (list garbage-collector-job
                                            updatedb-job))
                       %base-services)))

   *Note mcron job specifications: (mcron)Guile Syntax, for more
information on mcron job specifications.  Below is the reference of the
mcron service.

 -- Scheme Procedure: mcron-service JOBS [#:mcron MCRON2]
     Return an mcron service running MCRON that schedules JOBS, a list
     of gexps denoting mcron job specifications.

     This is a shorthand for:
            (service mcron-service-type
                     (mcron-configuration (mcron mcron) (jobs jobs)))

 -- Scheme Variable: mcron-service-type
     This is the type of the ‘mcron’ service, whose value is an
     ‘mcron-configuration’ object.

     This service type can be the target of a service extension that
     provides it additional job specifications (*note Service
     Composition::).  In other words, it is possible to define services
     that provide addition mcron jobs to run.

 -- Data Type: mcron-configuration
     Data type representing the configuration of mcron.

     ‘mcron’ (default: MCRON2)
          The mcron package to use.

     ‘jobs’
          This is a list of gexps (*note G-Expressions::), where each
          gexp corresponds to an mcron job specification (*note mcron
          job specifications: (mcron)Syntax.).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]