From 995bc9ca6ebf6880d7e7e6f3d1baa2941758fc47 Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Sat, 7 May 2016 11:09:44 +0200 Subject: all: Rename 'scm' directory to 'src'. * scm/mcron/config.scm.in: Rename to ... * src/mcron/config.scm.in: ... this. * scm/mcron/crontab.scm: Rename to ... * src/mcron/crontab.scm: ... this. * scm/mcron/environment.scm: Rename to ... * src/mcron/environment.scm: ... this. * scm/mcron/job-specifier.scm: Rename to ... * src/mcron/job-specifier.scm: ... this. * scm/mcron/main.scm: Rename to ... * src/mcron/main.scm: ... this. * scm/mcron/mcron-core.scm: Rename to ... * src/mcron/mcron-core.scm: ... this. * scm/mcron/redirect.scm: Rename to ... * src/mcron/redirect.scm: ... this. * scm/mcron/vixie-specification.scm: Rename to ... * src/mcron/vixie-specification.scm: ... this. * scm/mcron/vixie-time.scm: Rename to ... * src/mcron/vixie-time.scm: ... this. * mcron.c: Rename to ... * src/mcron.c: ... this. * Makefile.am: Adapt to them. * build-aux/pre-inst-env.in: Likewise. * configure.ac (AC_CONFIG_FILES): Likewise. (AC_CONFIG_HEADER): Set to 'src/config.h'. * .gitignore: Update. --- src/mcron/job-specifier.scm | 253 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 src/mcron/job-specifier.scm (limited to 'src/mcron/job-specifier.scm') diff --git a/src/mcron/job-specifier.scm b/src/mcron/job-specifier.scm new file mode 100644 index 0000000..1c2f9d9 --- /dev/null +++ b/src/mcron/job-specifier.scm @@ -0,0 +1,253 @@ +;; Copyright (C) 2003 Dale Mellor +;; Copyright (C) 2016 Mathieu Lirzin +;; +;; This file is part of GNU mcron. +;; +;; GNU mcron 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 mcron 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 mcron. If not, see . + + + +;; This module defines all the functions that can be used by scheme mcron +;; configuration files, namely the procedures for working out next times, the +;; job procedure for registering new jobs (actually a wrapper around the core +;; add-job function), and the procedure for declaring environment modifications. + +(define-module (mcron job-specifier) + #:use-module (ice-9 match) + #:use-module (mcron core) + #:use-module (mcron environment) + #:use-module (mcron vixie-time) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:re-export (append-environment-mods) + #:export (range + next-year-from next-year + next-month-from next-month + next-day-from next-day + next-hour-from next-hour + next-minute-from next-minute + next-second-from next-second + set-configuration-user + set-configuration-time + job)) + +(define* (range start end #:optional (step 1)) + "Produces a list of values from START up to (but not including) END. An +optional STEP may be supplied, and (if positive) only every step'th value will +go into the list. For example, (range 1 6 2) returns '(1 3 5)." + (unfold (cut >= <> end) identity (cute + <> (max step 1)) start)) + +(define (%find-best-next current next-list) + ;; Takes a value and a list of possible next values (all assumed less than + ;; 9999). It returns a pair consisting of the smallest element of the + ;; NEXT-LIST, and the smallest element larger than the CURRENT value. If an + ;; example of the latter cannot be found, 9999 will be returned. + (let loop ((smallest 9999) (closest+ 9999) (lst next-list)) + (match lst + (() (cons smallest closest+)) + ((time . rest) + (loop (min time smallest) + (if (> time current) (min time closest+) closest+) + rest))))) + +;; Internal function to return the time corresponding to some near future +;; hour. If hour-list is not supplied, the time returned corresponds to the +;; start of the next hour of the day. +;; +;; If the hour-list is supplied the time returned corresponds to the first hour +;; of the day in the future which is contained in the list. If all the values in +;; the list are less than the current hour, then the time returned will +;; correspond to the first hour in the list *on the following day*. +;; +;; ... except that the function is actually generalized to deal with seconds, +;; minutes, etc., in an obvious way :-) +;; +;; Note that value-list always comes from an optional argument to a procedure, +;; so is wrapped up as the first element of a list (i.e. it is a list inside a +;; list). + +(define (bump-time time value-list component higher-component + set-component! set-higher-component!) + (if (null? value-list) + (set-component! time (+ (component time) 1)) + (let ((best-next (%find-best-next (component time) (car value-list)))) + (if (eqv? 9999 (cdr best-next)) + (begin + (set-higher-component! time (+ (higher-component time) 1)) + (set-component! time (car best-next))) + (set-component! time (cdr best-next))))) + (car (mktime time))) + + + + +;; Set of configuration methods which use the above general function to bump +;; specific components of time to the next legitimate value. In each case, all +;; the components smaller than that of interest are taken to zero, so that for +;; example the time of the next year will be the time at which the next year +;; actually starts. + +(define (next-year-from current-time . year-list) + (let ((time (localtime current-time))) + (set-tm:mon time 0) + (set-tm:mday time 1) + (set-tm:hour time 0) + (set-tm:min time 0) + (set-tm:sec time 0) + (bump-time time year-list tm:year tm:year set-tm:year set-tm:year))) + +(define (next-month-from current-time . month-list) + (let ((time (localtime current-time))) + (set-tm:mday time 1) + (set-tm:hour time 0) + (set-tm:min time 0) + (set-tm:sec time 0) + (bump-time time month-list tm:mon tm:year set-tm:mon set-tm:year))) + +(define (next-day-from current-time . day-list) + (let ((time (localtime current-time))) + (set-tm:hour time 0) + (set-tm:min time 0) + (set-tm:sec time 0) + (bump-time time day-list tm:mday tm:mon set-tm:mday set-tm:mon))) + +(define (next-hour-from current-time . hour-list) + (let ((time (localtime current-time))) + (set-tm:min time 0) + (set-tm:sec time 0) + (bump-time time hour-list tm:hour tm:mday set-tm:hour set-tm:mday))) + +(define (next-minute-from current-time . minute-list) + (let ((time (localtime current-time))) + (set-tm:sec time 0) + (bump-time time minute-list tm:min tm:hour set-tm:min set-tm:hour))) + +(define (next-second-from current-time . second-list) + (let ((time (localtime current-time))) + (bump-time time second-list tm:sec tm:min set-tm:sec set-tm:min))) + + + +;; The current-action-time is the time a job was last run, the time from which +;; the next time to run a job must be computed. (When the program is first run, +;; this time is set to the configuration time so that jobs run from that moment +;; forwards.) Once we have this, we supply versions of the time computation +;; commands above which implicitly assume this value. + +(define current-action-time 0) + + + +;; We want to provide functions which take a single optional argument (as well +;; as implicitly the current action time), but unlike usual scheme behaviour if +;; the argument is missing we want to act like it is really missing, and if it +;; is there we want to act like it is a genuine argument, not a list of +;; optionals. + +(define (maybe-args function args) + (if (null? args) + (function current-action-time) + (function current-action-time (car args)))) + + + +;; These are the convenience functions we were striving to define for the +;; configuration files. They are wrappers for the next-X-from functions above, +;; but implicitly use the current-action-time for the time argument. + +(define (next-year . args) (maybe-args next-year-from args)) +(define (next-month . args) (maybe-args next-month-from args)) +(define (next-day . args) (maybe-args next-day-from args)) +(define (next-hour . args) (maybe-args next-hour-from args)) +(define (next-minute . args) (maybe-args next-minute-from args)) +(define (next-second . args) (maybe-args next-second-from args)) + + + +;; The default user for running jobs is the current one (who invoked this +;; program). There are exceptions: when cron parses /etc/crontab the user is +;; specified on each individual line; when cron parses /var/cron/tabs/* the user +;; is derived from the filename of the crontab. These cases are dealt with by +;; mutating this variable. Note that the variable is only used at configuration +;; time; a UID is stored with each job and it is that which takes effect when +;; the job actually runs. + +(define configuration-user (getpw (getuid))) +(define configuration-time (current-time)) + +(define (set-configuration-user user) + (set! configuration-user (if (or (string? user) + (integer? user)) + (getpw user) + user))) +(define (set-configuration-time time) (set! configuration-time time)) + + + +;; The job function, available to configuration files for adding a job rule to +;; the system. +;; +;; Here we must 'normalize' the next-time-function so that it is always a lambda +;; function which takes one argument (the last time the job ran) and returns a +;; single value (the next time the job should run). If the input value is a +;; string this is parsed as a Vixie-style time specification, and if it is a +;; list then we arrange to eval it (but note that such lists are expected to +;; ignore the function parameter - the last run time is always read from the +;; current-action-time global variable). A similar normalization is applied to +;; the action. +;; +;; Here we also compute the first time that the job is supposed to run, by +;; finding the next legitimate time from the current configuration time (set +;; right at the top of this program). + +(define (job time-proc action . displayable) + (let ((action (cond ((procedure? action) action) + ((list? action) (lambda () (primitive-eval action))) + ((string? action) (lambda () (system action))) + (else + (throw 'mcron-error 2 + "job: invalid second argument (action; should be lambda " + "function, string or list)")))) + + (time-proc + (cond ((procedure? time-proc) time-proc) + ((string? time-proc) (parse-vixie-time time-proc)) + ((list? time-proc) (lambda (current-time) + (primitive-eval time-proc))) + (else + (throw 'mcron-error 3 + "job: invalid first argument (next-time-function; " + "should be function, string or list)")))) + (displayable + (cond ((not (null? displayable)) (car displayable)) + ((procedure? action) "Lambda function") + ((string? action) action) + ((list? action) (with-output-to-string + (lambda () (display action))))))) + (add-job (lambda (current-time) + (set! current-action-time current-time) ;; ?? !!!! Code + + ;; Contributed by Sergey Poznyakoff to allow for daylight savings + ;; time changes. + (let* ((next (time-proc current-time)) + (gmtoff (tm:gmtoff (localtime next))) + (d (+ next (- gmtoff + (tm:gmtoff (localtime current-time)))))) + (if (eqv? (tm:gmtoff (localtime d)) gmtoff) + d + next))) + action + displayable + configuration-time + configuration-user))) -- cgit v1.2.3 From 418b81e1af8d18c86693cb43ffe89354af28e3a8 Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Sat, 7 May 2016 13:08:06 +0200 Subject: base: Rename (mcron core) module to (mcron base). The 'configure' script deletes the 'core.*' files. Having a file named 'base.scm' instead of 'core.scm' simplifies the build process without changing the semantics. * src/mcron/mcron-core.scm: Rename to ... * src/mcron/base.scm: ... this. All module users changed. * Makefile.am (MODULES): Add 'src/mcron/base.scm'. (CP): Remove variable. (src/mcron/core.scm): Remove target. (GEN_MODULES): Remove 'src/mcron/core.scm'. (dist_mcronmodule_DATA): Remove 'src/mcron/mcron-core.scm' * doc/mcron.texi: Adapt to name change. * .gitignore: Update. --- .gitignore | 1 - Makefile.am | 12 +- doc/mcron.texi | 24 ++-- src/mcron/base.scm | 270 ++++++++++++++++++++++++++++++++++++++ src/mcron/job-specifier.scm | 7 +- src/mcron/main.scm | 4 +- src/mcron/mcron-core.scm | 270 -------------------------------------- src/mcron/vixie-specification.scm | 2 +- 8 files changed, 292 insertions(+), 298 deletions(-) create mode 100644 src/mcron/base.scm delete mode 100644 src/mcron/mcron-core.scm (limited to 'src/mcron/job-specifier.scm') diff --git a/.gitignore b/.gitignore index 8bffc85..c064be1 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,6 @@ config.log config.scm config.status configure -core.scm depcomp install-sh missing diff --git a/Makefile.am b/Makefile.am index 1b5317c..f02b84e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,6 +23,7 @@ mcron_DEPENDENCIES = $(GOBJECTS) # Build Guile modules before linking. mcron_LDADD = @GUILE_LIBS@ MODULES = \ + src/mcron/base.scm \ src/mcron/environment.scm \ src/mcron/job-specifier.scm \ src/mcron/main.scm \ @@ -31,13 +32,7 @@ MODULES = \ src/mcron/vixie-time.scm GEN_MODULES = \ - src/mcron/config.scm \ - src/mcron/core.scm - -CP = @CP@ -# XXX: Prevent the 'configure' script to delete the 'core.*' files. -src/mcron/core.scm: src/mcron/mcron-core.scm - $(CP) $< $@ + src/mcron/config.scm GOBJECTS = \ $(GEN_MODULES:%.scm=%.go) \ @@ -49,8 +44,7 @@ mcronmodule_DATA = \ dist_mcronmodule_DATA = \ $(MODULES) \ - src/mcron/crontab.scm \ - src/mcron/mcron-core.scm + src/mcron/crontab.scm # Unset 'GUILE_LOAD_COMPILED_PATH' altogether while compiling. Otherwise, if # $GUILE_LOAD_COMPILED_PATH contains $(mcronmoduledir), we may find .go files diff --git a/doc/mcron.texi b/doc/mcron.texi index 27cd1b7..340faca 100644 --- a/doc/mcron.texi +++ b/doc/mcron.texi @@ -104,7 +104,7 @@ Detailed invoking Guile modules -* The core module:: The job list and execution loop. +* The base module:: The job list and execution loop. * The redirect module:: Sending output of jobs to a mail box. * The vixie-time module:: Parsing vixie-style time specifications. * The job-specifier module:: All commands for scheme configuration files. @@ -327,7 +327,7 @@ taken to be program code made up of the functions @code{(next-second . args)}, @code{(next-minute...)}, etc, where the optional arguments can be supplied with the @code{(range)} function above (these functions are analogous to the ones above except that they implicitly -assume the current time; it is supplied by the mcron core when the +assume the current time; it is supplied by the mcron base when the list is eval'd). @cindex time specification @@ -1150,26 +1150,26 @@ non-absolute time specified on the Gregorian calendar (the first day of next week, for example). Finally, it may be the wish of the user to provide a program with the functionality of mcron plus a bit extra. -The core module maintains mcron's internal job lists, and provides the +The base module maintains mcron's internal job lists, and provides the main wait-run-wait loop that is mcron's main function. It also introduces the facilities for accumulating a set of environment modifiers, which take effect when jobs run. @menu -* The core module:: The job list and execution loop. +* The base module:: The job list and execution loop. * The redirect module:: Sending output of jobs to a mail box. * The vixie-time module:: Parsing vixie-style time specifications. * The job-specifier module:: All commands for scheme configuration files. * The vixie-specification module:: Commands for reading vixie-style crontabs. @end menu -@node The core module, The redirect module, Guile modules, Guile modules -@section The core module +@node The base module, The redirect module, Guile modules, Guile modules +@section The base module @cindex guile module -@cindex core module -@cindex modules, core +@cindex base module +@cindex modules, base -This module may be used by including @code{(use-modules (mcron core))} +This module may be used by including @code{(use-modules (mcron base))} in a program. The main functions are @code{add-job} and @code{run-job-loop}, which allow a program to create a list of job specifications to run, and then to initiate the wait-run-wait loop @@ -1221,7 +1221,7 @@ becoming available for reading on one of the file descriptors in the fd-list, if supplied. Only in this case will the procedure return to the calling program, which may then make modifications to the job list before calling the @code{run-job-loop} procedure again to resume execution of -the mcron core. +the mcron base. @end deffn @deffn{Scheme procedure} remove-user-jobs user @@ -1242,7 +1242,7 @@ last job that was reported in the schedule report. The report itself is returned to the calling program as a string. @end deffn -@node The redirect module, The vixie-time module, The core module, Guile modules +@node The redirect module, The vixie-time module, The base module, Guile modules @section The redirect module @cindex redirect module @cindex modules, redirect @@ -1263,7 +1263,7 @@ vixie-time))}. This module provides a single method for converting a vixie-style time specification into a procedure which can be used as the -@code{next-time-function} to the core @code{add-job} procedure, or to +@code{next-time-function} to the base @code{add-job} procedure, or to the @code{job-specifier} @code{job} procedure. See @ref{Vixie Syntax} for full details of the allowed format for the time string. diff --git a/src/mcron/base.scm b/src/mcron/base.scm new file mode 100644 index 0000000..7094dbc --- /dev/null +++ b/src/mcron/base.scm @@ -0,0 +1,270 @@ +;; Copyright (C) 2015, 2016 Mathieu Lirzin +;; Copyright (C) 2003 Dale Mellor +;; +;; This file is part of GNU mcron. +;; +;; GNU mcron 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 mcron 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 mcron. If not, see . + + + +(define-module (mcron base) + #:use-module (mcron environment) + #:use-module (srfi srfi-9) + #:export (add-job + remove-user-jobs + get-schedule + run-job-loop + ;; These three are deprecated and not documented. + use-system-job-list + use-user-job-list + clear-system-jobs) + #:re-export (clear-environment-mods + append-environment-mods)) + + +(use-modules (srfi srfi-1) ;; For remove. + (srfi srfi-2)) ;; For and-let*. + + + +;; The list of all jobs known to the system. Each element of the list is +;; +;; (make-job user next-time-function action environment displayable next-time) +;; +;; where action must be a procedure, and the environment is an alist of +;; modifications that need making to the UNIX environment before the action is +;; run. The next-time element is the only one that is modified during the +;; running of a cron process (i.e. all the others are set once and for all at +;; configuration time). +;; +;; The reason we maintain two lists is that jobs in /etc/crontab may be placed +;; in one, and all other jobs go in the other. This makes it possible to remove +;; all the jobs in the first list in one go, and separately we can remove all +;; jobs from the second list which belong to a particular user. This behaviour +;; is required for full vixie compatibility. + +(define system-job-list '()) +(define user-job-list '()) + +(define configuration-source 'user) + +(define (use-system-job-list) (set! configuration-source 'system)) +(define (use-user-job-list) (set! configuration-source 'user)) + +;; A cron job. +(define-record-type + (make-job user time-proc action environment displayable next-time) + job? + (user job:user) ;object : passwd entry + (time-proc job:next-time-function) ;proc : with one 'time' parameter + (action job:action) ;thunk : user's code + (environment job:environment) ;alist : environment variables + (displayable job:displayable) ;string : visible in schedule + (next-time job:next-time ;number : time in UNIX format + job:next-time-set!)) + +;; Remove jobs from the user-job-list belonging to this user. + +(define (remove-user-jobs user) + (if (or (string? user) + (integer? user)) + (set! user (getpw user))) + (set! user-job-list + (remove (lambda (job) (eqv? (passwd:uid user) + (passwd:uid (job:user job)))) + user-job-list))) + + + +;; Remove all the jobs on the system job list. + +(define (clear-system-jobs) (set! system-job-list '())) + + + +;; Add a new job with the given specifications to the head of the appropriate +;; jobs list. + +(define (add-job time-proc action displayable configuration-time + configuration-user) + (let ((entry (make-job configuration-user + time-proc + action + (get-current-environment-mods-copy) + displayable + (time-proc configuration-time)))) + (if (eq? configuration-source 'user) + (set! user-job-list (cons entry user-job-list)) + (set! system-job-list (cons entry system-job-list))))) + + + +;; Procedure to locate the jobs in the global job-list with the lowest +;; (soonest) next-times. These are the jobs for which we must schedule the mcron +;; program (under any personality) to next wake up. The return value is a cons +;; cell consisting of the next time (maintained in the next-time variable) and a +;; list of the job entries that are to run at this time (maintained in the +;; next-jobs-list variable). +;; +;; The procedure works by first obtaining the time of the first job on the list, +;; and setting this job in the next-jobs-list. Then for each other entry on the +;; job-list, either the job runs earlier than any other that have been scanned, +;; in which case the next-time and next-jobs-list are re-initialized to +;; accomodate, or the job runs at the same time as the next job, in which case +;; the next-jobs-list is simply augmented with the new job, or else the job runs +;; later than others noted in which case we ignore it for now and continue to +;; recurse the list. + +(define (find-next-jobs) + (let ((job-list (append system-job-list user-job-list))) + + (if (null? job-list) + + '(#f . '()) + + (let ((next-time 2000000000) + (next-jobs-list '())) + + (for-each + (lambda (job) + (let ((this-time (job:next-time job))) + (cond ((< this-time next-time) + (set! next-time this-time) + (set! next-jobs-list (list job))) + ((eqv? this-time next-time) + (set! next-jobs-list (cons job next-jobs-list)))))) + job-list) + + (cons next-time next-jobs-list))))) + + + +;; Create a string containing a textual list of the next count jobs to run. +;; +;; Enter a loop of displaying the next set of jobs to run, artificially +;; forwarding the time to the next time point (instead of waiting for it to +;; occur as we would do in a normal run of mcron), and recurse around the loop +;; count times. +;; +;; Note that this has the effect of mutating the job timings. Thus the program +;; must exit after calling this function; the internal data state will be left +;; unusable. + +(define (get-schedule count) + (with-output-to-string + (lambda () + (do ((count count (- count 1))) + ((eqv? count 0)) + (and-let* + ((next-jobs (find-next-jobs)) + (time (car next-jobs)) + (date-string (strftime "%c %z\n" (localtime time)))) + (for-each (lambda (job) + (display date-string) + (display (job:displayable job)) + (newline)(newline) + (job:next-time-set! job ((job:next-time-function job) + (job:next-time job)))) + (cdr next-jobs))))))) + + + +;; For proper housekeeping, it is necessary to keep a record of the number of +;; child processes we fork off to run the jobs. + +(define number-children 0) + + + +;; For every job on the list, fork a process to run it (noting the fact by +;; increasing the number-children counter), and in the new process set up the +;; run-time environment exactly as it should be before running the job proper. +;; +;; In the parent, update the job entry by computing the next time the job needs +;; to run. + +(define (run-jobs jobs-list) + (for-each + (lambda (job) + (if (eqv? (primitive-fork) 0) + (begin + (setgid (passwd:gid (job:user job))) + (setuid (passwd:uid (job:user job))) + (chdir (passwd:dir (job:user job))) + (modify-environment (job:environment job) (job:user job)) + ((job:action job)) + (primitive-exit 0)) + (begin + (set! number-children (+ number-children 1)) + (job:next-time-set! job ((job:next-time-function job) + (current-time)))))) + jobs-list)) + + + +;; Give any zombie children a chance to die, and decrease the number known to +;; exist. + +(define (child-cleanup) + (do () ((or (<= number-children 0) + (eqv? (car (waitpid WAIT_ANY WNOHANG)) 0))) + (set! number-children (- number-children 1)))) + + + +;; Now the main loop. Loop over all job specifications, get a list of the next +;; ones to run (may be more than one). Set an alarm and go to sleep. When we +;; wake, run the jobs and reap any children (old jobs) that have +;; completed. Repeat ad infinitum. +;; +;; Note that, if we wake ahead of time, it can only mean that a signal has been +;; sent by a crontab job to tell us to re-read a crontab file. In this case we +;; break out of the loop here, and let the main procedure deal with the +;; situation (it will eventually re-call this function, thus maintaining the +;; loop). + +(define (run-job-loop . fd-list) + + (call-with-current-continuation + (lambda (break) + + (let ((fd-list (if (null? fd-list) '() (car fd-list)))) + + (let loop () + + (let* ((next-jobs (find-next-jobs)) + (next-time (car next-jobs)) + (next-jobs-list (cdr next-jobs)) + (sleep-time (if next-time (- next-time (current-time)) + 2000000000))) + + (and (> sleep-time 0) + (if (not (null? + (catch 'system-error + (lambda () + (car (select fd-list '() '() sleep-time))) + (lambda (key . args) ;; Exception add by Sergey + ;; Poznyakoff. + (if (member (car (last args)) + (list EINTR EAGAIN)) + (begin + (child-cleanup) '()) + (apply throw key args)))))) + (break))) + + (run-jobs next-jobs-list) + + (child-cleanup) + + (loop))))))) diff --git a/src/mcron/job-specifier.scm b/src/mcron/job-specifier.scm index 1c2f9d9..9e13551 100644 --- a/src/mcron/job-specifier.scm +++ b/src/mcron/job-specifier.scm @@ -20,12 +20,13 @@ ;; This module defines all the functions that can be used by scheme mcron ;; configuration files, namely the procedures for working out next times, the -;; job procedure for registering new jobs (actually a wrapper around the core -;; add-job function), and the procedure for declaring environment modifications. +;; job procedure for registering new jobs (actually a wrapper around the +;; base add-job function), and the procedure for declaring environment +;; modifications. (define-module (mcron job-specifier) #:use-module (ice-9 match) - #:use-module (mcron core) + #:use-module (mcron base) #:use-module (mcron environment) #:use-module (mcron vixie-time) #:use-module (srfi srfi-1) diff --git a/src/mcron/main.scm b/src/mcron/main.scm index 1f2b068..db7dfd6 100644 --- a/src/mcron/main.scm +++ b/src/mcron/main.scm @@ -25,7 +25,7 @@ #:use-module (ice-9 rdelim) #:use-module (ice-9 regex) #:use-module (mcron config) - #:use-module (mcron core) + #:use-module (mcron base) #:use-module (mcron job-specifier) #:use-module (mcron vixie-specification) #:use-module (srfi srfi-2) @@ -389,7 +389,7 @@ option.\n") (lambda () (display (getpid)) (newline))))) ;; Now the main loop. Forever execute the run-job-loop procedure in the - ;; mcron core, and when it drops out (can only be because a message has come + ;; mcron base, and when it drops out (can only be because a message has come ;; in on the socket) we process the socket request before restarting the ;; loop again. Sergey Poznyakoff: we can also drop out of run-job-loop ;; because of a SIGCHLD, so must test FDES-LIST. diff --git a/src/mcron/mcron-core.scm b/src/mcron/mcron-core.scm deleted file mode 100644 index 13781c9..0000000 --- a/src/mcron/mcron-core.scm +++ /dev/null @@ -1,270 +0,0 @@ -;; Copyright (C) 2015, 2016 Mathieu Lirzin -;; Copyright (C) 2003 Dale Mellor -;; -;; This file is part of GNU mcron. -;; -;; GNU mcron 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 mcron 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 mcron. If not, see . - - - -(define-module (mcron core) - #:use-module (mcron environment) - #:use-module (srfi srfi-9) - #:export (add-job - remove-user-jobs - get-schedule - run-job-loop - ;; These three are deprecated and not documented. - use-system-job-list - use-user-job-list - clear-system-jobs) - #:re-export (clear-environment-mods - append-environment-mods)) - - -(use-modules (srfi srfi-1) ;; For remove. - (srfi srfi-2)) ;; For and-let*. - - - -;; The list of all jobs known to the system. Each element of the list is -;; -;; (make-job user next-time-function action environment displayable next-time) -;; -;; where action must be a procedure, and the environment is an alist of -;; modifications that need making to the UNIX environment before the action is -;; run. The next-time element is the only one that is modified during the -;; running of a cron process (i.e. all the others are set once and for all at -;; configuration time). -;; -;; The reason we maintain two lists is that jobs in /etc/crontab may be placed -;; in one, and all other jobs go in the other. This makes it possible to remove -;; all the jobs in the first list in one go, and separately we can remove all -;; jobs from the second list which belong to a particular user. This behaviour -;; is required for full vixie compatibility. - -(define system-job-list '()) -(define user-job-list '()) - -(define configuration-source 'user) - -(define (use-system-job-list) (set! configuration-source 'system)) -(define (use-user-job-list) (set! configuration-source 'user)) - -;; A cron job. -(define-record-type - (make-job user time-proc action environment displayable next-time) - job? - (user job:user) ;object : passwd entry - (time-proc job:next-time-function) ;proc : with one 'time' parameter - (action job:action) ;thunk : user's code - (environment job:environment) ;alist : environment variables - (displayable job:displayable) ;string : visible in schedule - (next-time job:next-time ;number : time in UNIX format - job:next-time-set!)) - -;; Remove jobs from the user-job-list belonging to this user. - -(define (remove-user-jobs user) - (if (or (string? user) - (integer? user)) - (set! user (getpw user))) - (set! user-job-list - (remove (lambda (job) (eqv? (passwd:uid user) - (passwd:uid (job:user job)))) - user-job-list))) - - - -;; Remove all the jobs on the system job list. - -(define (clear-system-jobs) (set! system-job-list '())) - - - -;; Add a new job with the given specifications to the head of the appropriate -;; jobs list. - -(define (add-job time-proc action displayable configuration-time - configuration-user) - (let ((entry (make-job configuration-user - time-proc - action - (get-current-environment-mods-copy) - displayable - (time-proc configuration-time)))) - (if (eq? configuration-source 'user) - (set! user-job-list (cons entry user-job-list)) - (set! system-job-list (cons entry system-job-list))))) - - - -;; Procedure to locate the jobs in the global job-list with the lowest -;; (soonest) next-times. These are the jobs for which we must schedule the mcron -;; program (under any personality) to next wake up. The return value is a cons -;; cell consisting of the next time (maintained in the next-time variable) and a -;; list of the job entries that are to run at this time (maintained in the -;; next-jobs-list variable). -;; -;; The procedure works by first obtaining the time of the first job on the list, -;; and setting this job in the next-jobs-list. Then for each other entry on the -;; job-list, either the job runs earlier than any other that have been scanned, -;; in which case the next-time and next-jobs-list are re-initialized to -;; accomodate, or the job runs at the same time as the next job, in which case -;; the next-jobs-list is simply augmented with the new job, or else the job runs -;; later than others noted in which case we ignore it for now and continue to -;; recurse the list. - -(define (find-next-jobs) - (let ((job-list (append system-job-list user-job-list))) - - (if (null? job-list) - - '(#f . '()) - - (let ((next-time 2000000000) - (next-jobs-list '())) - - (for-each - (lambda (job) - (let ((this-time (job:next-time job))) - (cond ((< this-time next-time) - (set! next-time this-time) - (set! next-jobs-list (list job))) - ((eqv? this-time next-time) - (set! next-jobs-list (cons job next-jobs-list)))))) - job-list) - - (cons next-time next-jobs-list))))) - - - -;; Create a string containing a textual list of the next count jobs to run. -;; -;; Enter a loop of displaying the next set of jobs to run, artificially -;; forwarding the time to the next time point (instead of waiting for it to -;; occur as we would do in a normal run of mcron), and recurse around the loop -;; count times. -;; -;; Note that this has the effect of mutating the job timings. Thus the program -;; must exit after calling this function; the internal data state will be left -;; unusable. - -(define (get-schedule count) - (with-output-to-string - (lambda () - (do ((count count (- count 1))) - ((eqv? count 0)) - (and-let* - ((next-jobs (find-next-jobs)) - (time (car next-jobs)) - (date-string (strftime "%c %z\n" (localtime time)))) - (for-each (lambda (job) - (display date-string) - (display (job:displayable job)) - (newline)(newline) - (job:next-time-set! job ((job:next-time-function job) - (job:next-time job)))) - (cdr next-jobs))))))) - - - -;; For proper housekeeping, it is necessary to keep a record of the number of -;; child processes we fork off to run the jobs. - -(define number-children 0) - - - -;; For every job on the list, fork a process to run it (noting the fact by -;; increasing the number-children counter), and in the new process set up the -;; run-time environment exactly as it should be before running the job proper. -;; -;; In the parent, update the job entry by computing the next time the job needs -;; to run. - -(define (run-jobs jobs-list) - (for-each - (lambda (job) - (if (eqv? (primitive-fork) 0) - (begin - (setgid (passwd:gid (job:user job))) - (setuid (passwd:uid (job:user job))) - (chdir (passwd:dir (job:user job))) - (modify-environment (job:environment job) (job:user job)) - ((job:action job)) - (primitive-exit 0)) - (begin - (set! number-children (+ number-children 1)) - (job:next-time-set! job ((job:next-time-function job) - (current-time)))))) - jobs-list)) - - - -;; Give any zombie children a chance to die, and decrease the number known to -;; exist. - -(define (child-cleanup) - (do () ((or (<= number-children 0) - (eqv? (car (waitpid WAIT_ANY WNOHANG)) 0))) - (set! number-children (- number-children 1)))) - - - -;; Now the main loop. Loop over all job specifications, get a list of the next -;; ones to run (may be more than one). Set an alarm and go to sleep. When we -;; wake, run the jobs and reap any children (old jobs) that have -;; completed. Repeat ad infinitum. -;; -;; Note that, if we wake ahead of time, it can only mean that a signal has been -;; sent by a crontab job to tell us to re-read a crontab file. In this case we -;; break out of the loop here, and let the main procedure deal with the -;; situation (it will eventually re-call this function, thus maintaining the -;; loop). - -(define (run-job-loop . fd-list) - - (call-with-current-continuation - (lambda (break) - - (let ((fd-list (if (null? fd-list) '() (car fd-list)))) - - (let loop () - - (let* ((next-jobs (find-next-jobs)) - (next-time (car next-jobs)) - (next-jobs-list (cdr next-jobs)) - (sleep-time (if next-time (- next-time (current-time)) - 2000000000))) - - (and (> sleep-time 0) - (if (not (null? - (catch 'system-error - (lambda () - (car (select fd-list '() '() sleep-time))) - (lambda (key . args) ;; Exception add by Sergey - ;; Poznyakoff. - (if (member (car (last args)) - (list EINTR EAGAIN)) - (begin - (child-cleanup) '()) - (apply throw key args)))))) - (break))) - - (run-jobs next-jobs-list) - - (child-cleanup) - - (loop))))))) diff --git a/src/mcron/vixie-specification.scm b/src/mcron/vixie-specification.scm index 5cd1528..f055383 100644 --- a/src/mcron/vixie-specification.scm +++ b/src/mcron/vixie-specification.scm @@ -30,7 +30,7 @@ read-vixie-file check-system-crontab) #:use-module ((mcron config) :select (config-socket-file)) - #:use-module (mcron core) + #:use-module (mcron base) #:use-module (mcron job-specifier) #:use-module (mcron redirect) #:use-module (mcron vixie-time)) -- cgit v1.2.3 From 31baff1a5187d8ddc89324cbe42dbeffc309c962 Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Sat, 7 May 2016 18:51:49 +0200 Subject: job-specifier: job: Add #:user keyword argument. * src/mcron/job-specifier.scm (job): Add #:user keyword argument. * doc/mcron.texi (Job specification): Document it. --- doc/mcron.texi | 25 +++++++++++++------------ src/mcron/job-specifier.scm | 12 ++++++++---- 2 files changed, 21 insertions(+), 16 deletions(-) (limited to 'src/mcron/job-specifier.scm') diff --git a/doc/mcron.texi b/doc/mcron.texi index 340faca..a59505d 100644 --- a/doc/mcron.texi +++ b/doc/mcron.texi @@ -271,11 +271,13 @@ on your system, as root. @cindex guile syntax @cindex syntax, guile @findex job -In Guile-formatted configuration files each command that needs -executing is introduced with the @code{job} function. This function -always takes two arguments, the first a time specification, and the -second a command specification. An optional third argument may contain -a string to display when this job is listed in a schedule. +In Guile-formatted configuration files each command that needs executing is +introduced with the @code{job} function. This function always takes two +arguments, the first a time specification, and the second a command +specification. An optional third argument may contain a string to display +when this job is listed in a schedule. Additionally a @var{user} keyword +argument can be supplied to use a different user than the one defined in +@code{configuration-user} global variable. @cindex time specification, procedure @cindex procedure time specification @@ -342,13 +344,12 @@ on Vixie syntax for this. @cindex job execution @cindex command execution @cindex execution -The second argument to the @code{(job)} function can be either a -string, a list, or a function. In all cases the command is executed in -the user's home directory, under the user's own UID. If a string is -passed, it is assumed to be shell script and is executed with the -user's default shell. If a list is passed it is assumed to be scheme -code and is eval'd as such. A supplied function should take exactly -zero arguments, and will be called at the pertinent times. +The second argument to the @code{(job)} function can be either a string, a +list, or a function. The command is executed in the home directory and with +the UID of @var{user}. If a string is passed, it is assumed to be shell +script and is executed with the user's default shell. If a list is passed it +is assumed to be scheme code and is eval'd as such. A supplied function +should take exactly zero arguments, and will be called at the pertinent times. @subsection Sending output as e-mail @cindex email output diff --git a/src/mcron/job-specifier.scm b/src/mcron/job-specifier.scm index 9e13551..6dacece 100644 --- a/src/mcron/job-specifier.scm +++ b/src/mcron/job-specifier.scm @@ -212,7 +212,8 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)." ;; finding the next legitimate time from the current configuration time (set ;; right at the top of this program). -(define (job time-proc action . displayable) +(define* (job time-proc action #:optional displayable + #:key (user configuration-user)) (let ((action (cond ((procedure? action) action) ((list? action) (lambda () (primitive-eval action))) ((string? action) (lambda () (system action))) @@ -231,11 +232,14 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)." "job: invalid first argument (next-time-function; " "should be function, string or list)")))) (displayable - (cond ((not (null? displayable)) (car displayable)) + (cond (displayable displayable) ((procedure? action) "Lambda function") ((string? action) action) ((list? action) (with-output-to-string - (lambda () (display action))))))) + (lambda () (display action)))))) + (user* (if (or (string? user) (integer? user)) + (getpw user) + user))) (add-job (lambda (current-time) (set! current-action-time current-time) ;; ?? !!!! Code @@ -251,4 +255,4 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)." action displayable configuration-time - configuration-user))) + user*))) -- cgit v1.2.3 From ae6deb8ea23570c02a7b575a53bba37048aab59f Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Sun, 17 Jul 2016 19:18:29 +0200 Subject: job-specifier: Use 'inf' thunk. * src/mcron/job-specifier.scm (%find-best-next): Call 'inf' thunk instead of defining an arbitrary high integer. (bump-time): Adapt to it. --- src/mcron/job-specifier.scm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/mcron/job-specifier.scm') diff --git a/src/mcron/job-specifier.scm b/src/mcron/job-specifier.scm index 6dacece..5b17984 100644 --- a/src/mcron/job-specifier.scm +++ b/src/mcron/job-specifier.scm @@ -50,11 +50,11 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)." (unfold (cut >= <> end) identity (cute + <> (max step 1)) start)) (define (%find-best-next current next-list) - ;; Takes a value and a list of possible next values (all assumed less than - ;; 9999). It returns a pair consisting of the smallest element of the - ;; NEXT-LIST, and the smallest element larger than the CURRENT value. If an - ;; example of the latter cannot be found, 9999 will be returned. - (let loop ((smallest 9999) (closest+ 9999) (lst next-list)) + ;; Takes a value and a list of possible next values. It returns a pair + ;; consisting of the smallest element of the NEXT-LIST, and the smallest + ;; element larger than the CURRENT value. If an example of the latter + ;; cannot be found, +INF.0 will be returned. + (let loop ((smallest (inf)) (closest+ (inf)) (lst next-list)) (match lst (() (cons smallest closest+)) ((time . rest) @@ -83,7 +83,7 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)." (if (null? value-list) (set-component! time (+ (component time) 1)) (let ((best-next (%find-best-next (component time) (car value-list)))) - (if (eqv? 9999 (cdr best-next)) + (if (inf? (cdr best-next)) (begin (set-higher-component! time (+ (higher-component time) 1)) (set-component! time (car best-next))) -- cgit v1.2.3 From ea2058f14a67bb2169255c61fd9751169c43b433 Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Mon, 18 Jul 2016 00:31:23 +0200 Subject: job-specifier: Rewrite 'bump-time'. * src/mcron/job-specifier.scm (bump-time): Use 'match'. --- src/mcron/job-specifier.scm | 55 ++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 28 deletions(-) (limited to 'src/mcron/job-specifier.scm') diff --git a/src/mcron/job-specifier.scm b/src/mcron/job-specifier.scm index 5b17984..e66621e 100644 --- a/src/mcron/job-specifier.scm +++ b/src/mcron/job-specifier.scm @@ -62,36 +62,35 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)." (if (> time current) (min time closest+) closest+) rest))))) -;; Internal function to return the time corresponding to some near future -;; hour. If hour-list is not supplied, the time returned corresponds to the -;; start of the next hour of the day. -;; -;; If the hour-list is supplied the time returned corresponds to the first hour -;; of the day in the future which is contained in the list. If all the values in -;; the list are less than the current hour, then the time returned will -;; correspond to the first hour in the list *on the following day*. -;; -;; ... except that the function is actually generalized to deal with seconds, -;; minutes, etc., in an obvious way :-) -;; -;; Note that value-list always comes from an optional argument to a procedure, -;; so is wrapped up as the first element of a list (i.e. it is a list inside a -;; list). - (define (bump-time time value-list component higher-component set-component! set-higher-component!) - (if (null? value-list) - (set-component! time (+ (component time) 1)) - (let ((best-next (%find-best-next (component time) (car value-list)))) - (if (inf? (cdr best-next)) - (begin - (set-higher-component! time (+ (higher-component time) 1)) - (set-component! time (car best-next))) - (set-component! time (cdr best-next))))) - (car (mktime time))) - - - + ;; Return the time corresponding to some near future hour. If hour-list is + ;; not supplied, the time returned corresponds to the start of the next hour + ;; of the day. + ;; + ;; If the hour-list is supplied the time returned corresponds to the first + ;; hour of the day in the future which is contained in the list. If all the + ;; values in the list are less than the current hour, then the time returned + ;; will correspond to the first hour in the list *on the following day*. + ;; + ;; ... except that the function is actually generalized to deal with + ;; seconds, minutes, etc., in an obvious way :-) + ;; + ;; Note that value-list always comes from an optional argument to a + ;; procedure, so is wrapped up as the first element of a list (i.e. it is a + ;; list inside a list). + (match value-list + (() + (set-component! time (1+ (component time)))) + ((val . rest) + (match (%find-best-next (component time) val) + ((smallest . closest+) + (cond ((inf? closest+) + (set-higher-component! time (1+ (higher-component time))) + (set-component! time smallest)) + (else + (set-component! time closest+))))))) + (first (mktime time))) ;; Set of configuration methods which use the above general function to bump ;; specific components of time to the next legitimate value. In each case, all -- cgit v1.2.3 From 109555a9ddf5a60e5e0530b64105127bcaa27c91 Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Mon, 18 Jul 2016 01:25:21 +0200 Subject: job-specifier: Add %current-action-time parameter object. * src/mcron/job-specifier.scm (current-action-time): Rename to ... (%current-action-time): ... this. Make it a parameter object. (job, maybe-args): Adapt. --- src/mcron/job-specifier.scm | 47 ++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 26 deletions(-) (limited to 'src/mcron/job-specifier.scm') diff --git a/src/mcron/job-specifier.scm b/src/mcron/job-specifier.scm index e66621e..bf1ec89 100644 --- a/src/mcron/job-specifier.scm +++ b/src/mcron/job-specifier.scm @@ -137,17 +137,13 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)." (let ((time (localtime current-time))) (bump-time time second-list tm:sec tm:min set-tm:sec set-tm:min))) - - -;; The current-action-time is the time a job was last run, the time from which -;; the next time to run a job must be computed. (When the program is first run, -;; this time is set to the configuration time so that jobs run from that moment -;; forwards.) Once we have this, we supply versions of the time computation -;; commands above which implicitly assume this value. - -(define current-action-time 0) - - +(define %current-action-time + ;; The time a job was last run, the time from which the next time to run a + ;; job must be computed. (When the program is first run, this time is set to + ;; the configuration time so that jobs run from that moment forwards.) Once + ;; we have this, we supply versions of the time computation commands above + ;; which implicitly assume this value. + (make-parameter 0)) ;; We want to provide functions which take a single optional argument (as well ;; as implicitly the current action time), but unlike usual scheme behaviour if @@ -157,14 +153,14 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)." (define (maybe-args function args) (if (null? args) - (function current-action-time) - (function current-action-time (car args)))) + (function (%current-action-time)) + (function (%current-action-time) (car args)))) ;; These are the convenience functions we were striving to define for the ;; configuration files. They are wrappers for the next-X-from functions above, -;; but implicitly use the current-action-time for the time argument. +;; but implicitly use %CURRENT-ACTION-TIME for the time argument. (define (next-year . args) (maybe-args next-year-from args)) (define (next-month . args) (maybe-args next-month-from args)) @@ -204,7 +200,7 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)." ;; string this is parsed as a Vixie-style time specification, and if it is a ;; list then we arrange to eval it (but note that such lists are expected to ;; ignore the function parameter - the last run time is always read from the -;; current-action-time global variable). A similar normalization is applied to +;; %CURRENT-ACTION-TIME parameter object). A similar normalization is applied to ;; the action. ;; ;; Here we also compute the first time that the job is supposed to run, by @@ -240,17 +236,16 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)." (getpw user) user))) (add-job (lambda (current-time) - (set! current-action-time current-time) ;; ?? !!!! Code - - ;; Contributed by Sergey Poznyakoff to allow for daylight savings - ;; time changes. - (let* ((next (time-proc current-time)) - (gmtoff (tm:gmtoff (localtime next))) - (d (+ next (- gmtoff - (tm:gmtoff (localtime current-time)))))) - (if (eqv? (tm:gmtoff (localtime d)) gmtoff) - d - next))) + (parameterize ((%current-action-time current-time)) + ;; Allow for daylight savings time changes. + (let* ((next (time-proc current-time)) + (gmtoff (tm:gmtoff (localtime next))) + (d (+ next + (- gmtoff + (tm:gmtoff (localtime current-time)))))) + (if (eqv? (tm:gmtoff (localtime d)) gmtoff) + d + next)))) action displayable configuration-time -- cgit v1.2.3 From 913e3c65e4f56476e8ac69f4892cf92c125751ec Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Mon, 18 Jul 2016 13:31:34 +0200 Subject: job-specifier: Use #:optional keyword argument. * src/mcron/job-specifier.scm (next-year, next-year-from, next-month) (next-month-from, next-day, next-day-from, next-hour, next-hour-from) (next-minute, next-minute-from, next-second, next-second-from): Use #:optional keyword argument. (maybe-args): Remove unneeded procedure. --- src/mcron/job-specifier.scm | 54 +++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'src/mcron/job-specifier.scm') diff --git a/src/mcron/job-specifier.scm b/src/mcron/job-specifier.scm index bf1ec89..5d60484 100644 --- a/src/mcron/job-specifier.scm +++ b/src/mcron/job-specifier.scm @@ -98,7 +98,7 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)." ;; example the time of the next year will be the time at which the next year ;; actually starts. -(define (next-year-from current-time . year-list) +(define* (next-year-from current-time #:optional (year-list '())) (let ((time (localtime current-time))) (set-tm:mon time 0) (set-tm:mday time 1) @@ -107,7 +107,7 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)." (set-tm:sec time 0) (bump-time time year-list tm:year tm:year set-tm:year set-tm:year))) -(define (next-month-from current-time . month-list) +(define* (next-month-from current-time #:optional (month-list '())) (let ((time (localtime current-time))) (set-tm:mday time 1) (set-tm:hour time 0) @@ -115,28 +115,32 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)." (set-tm:sec time 0) (bump-time time month-list tm:mon tm:year set-tm:mon set-tm:year))) -(define (next-day-from current-time . day-list) +(define* (next-day-from current-time #:optional (day-list '())) (let ((time (localtime current-time))) (set-tm:hour time 0) (set-tm:min time 0) (set-tm:sec time 0) (bump-time time day-list tm:mday tm:mon set-tm:mday set-tm:mon))) -(define (next-hour-from current-time . hour-list) +(define* (next-hour-from current-time #:optional (hour-list '())) (let ((time (localtime current-time))) (set-tm:min time 0) (set-tm:sec time 0) (bump-time time hour-list tm:hour tm:mday set-tm:hour set-tm:mday))) -(define (next-minute-from current-time . minute-list) +(define* (next-minute-from current-time #:optional (minute-list '())) (let ((time (localtime current-time))) (set-tm:sec time 0) (bump-time time minute-list tm:min tm:hour set-tm:min set-tm:hour))) -(define (next-second-from current-time . second-list) +(define* (next-second-from current-time #:optional (second-list '())) (let ((time (localtime current-time))) (bump-time time second-list tm:sec tm:min set-tm:sec set-tm:min))) +;;; The following procedures are convenient for configuration files. They are +;;; wrappers for the next-X-from functions above, by implicitly using +;;; %CURRENT-ACTION-TIME as the time argument. + (define %current-action-time ;; The time a job was last run, the time from which the next time to run a ;; job must be computed. (When the program is first run, this time is set to @@ -145,31 +149,29 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)." ;; which implicitly assume this value. (make-parameter 0)) -;; We want to provide functions which take a single optional argument (as well -;; as implicitly the current action time), but unlike usual scheme behaviour if -;; the argument is missing we want to act like it is really missing, and if it -;; is there we want to act like it is a genuine argument, not a list of -;; optionals. - -(define (maybe-args function args) - (if (null? args) - (function (%current-action-time)) - (function (%current-action-time) (car args)))) - +(define* (next-year #:optional (args '())) + "Compute the next year from %CURRENT-ACTION-TIME parameter object." + (next-year-from (%current-action-time) args)) +(define* (next-month #:optional (args '())) + "Compute the next month from %CURRENT-ACTION-TIME parameter object." + (next-month-from (%current-action-time) args)) -;; These are the convenience functions we were striving to define for the -;; configuration files. They are wrappers for the next-X-from functions above, -;; but implicitly use %CURRENT-ACTION-TIME for the time argument. +(define* (next-day #:optional (args '())) + "Compute the next day from %CURRENT-ACTION-TIME parameter object." + (next-day-from (%current-action-time) args)) -(define (next-year . args) (maybe-args next-year-from args)) -(define (next-month . args) (maybe-args next-month-from args)) -(define (next-day . args) (maybe-args next-day-from args)) -(define (next-hour . args) (maybe-args next-hour-from args)) -(define (next-minute . args) (maybe-args next-minute-from args)) -(define (next-second . args) (maybe-args next-second-from args)) +(define* (next-hour #:optional (args '())) + "Compute the next hour from %CURRENT-ACTION-TIME parameter object." + (next-hour-from (%current-action-time) args)) +(define* (next-minute #:optional (args '())) + "Compute the next minute from %CURRENT-ACTION-TIME parameter object." + (next-minute-from (%current-action-time) args)) +(define* (next-second #:optional (args '())) + "Compute the next second from %CURRENT-ACTION-TIME parameter object." + (next-second-from (%current-action-time) args)) ;; The default user for running jobs is the current one (who invoked this ;; program). There are exceptions: when cron parses /etc/crontab the user is -- cgit v1.2.3 From 2cdd544a56e4b340f1744cfe2ab6439aa815045c Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Mon, 18 Jul 2016 17:25:27 +0200 Subject: maint: Reformat copyright notices and copying permission statements. --- Makefile.am | 13 ++++---- configure.ac | 41 ++++++++++++------------- src/mcron/base.scm | 39 ++++++++++++------------ src/mcron/config.scm.in | 40 +++++++++++------------- src/mcron/environment.scm | 64 +++++++++++++++++++-------------------- src/mcron/job-specifier.scm | 50 +++++++++++++++--------------- src/mcron/main.scm | 35 ++++++++++----------- src/mcron/redirect.scm | 63 ++++++++++++++++++++------------------ src/mcron/vixie-specification.scm | 51 ++++++++++++++++--------------- src/mcron/vixie-time.scm | 33 ++++++++++---------- src/wrapper.c | 4 +-- 11 files changed, 218 insertions(+), 215 deletions(-) (limited to 'src/mcron/job-specifier.scm') diff --git a/Makefile.am b/Makefile.am index 61f1c7b..52a8499 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,20 +1,21 @@ ## Process this file with automake to produce Makefile.in. - -# Copyright (C) 2003 Dale Mellor -# Copyright (C) 2015, 2016 Mathieu Lirzin +# Copyright © 2003 Dale Mellor +# Copyright © 2015, 2016 Mathieu Lirzin +# +# This file is part of GNU Mcron. # -# This program is free software: you can redistribute it and/or modify +# GNU Mcron 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. # -# This program is distributed in the hope that it will be useful, +# GNU Mcron 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 this program. If not, see . +# along with GNU Mcron. If not, see . bin_PROGRAMS = mcron crontab sbin_PROGRAMS = cron diff --git a/configure.ac b/configure.ac index 5b2fcf6..97c900b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,25 +1,22 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - - -# Copyright (C) 2003, 2005, 2012, 2014 Dale Mellor -# Copyright (C) 2015, 2016 Mathieu Lirzin -# -# This file is part of GNU mcron. -# -# GNU mcron 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 mcron 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 mcron. If not, see . - +## Process this file with autoconf to produce a configure script. +# Copyright © 2003, 2005, 2012, 2014 Dale Mellor +# +# Copyright © 2015, 2016 Mathieu Lirzin +# +# This file is part of GNU Mcron. +# +# GNU Mcron 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 Mcron 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 Mcron. If not, see . AC_PREREQ(2.61) AC_INIT([GNU Mcron], [1.0.8], [bug-mcron@gnu.org]) diff --git a/src/mcron/base.scm b/src/mcron/base.scm index b779c8a..b607c05 100644 --- a/src/mcron/base.scm +++ b/src/mcron/base.scm @@ -1,23 +1,22 @@ -;; Copyright (C) 2016 Ludovic Courtès -;; Copyright (C) 2015, 2016 Mathieu Lirzin -;; Copyright (C) 2003 Dale Mellor -;; -;; This file is part of GNU mcron. -;; -;; GNU mcron 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 mcron 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 mcron. If not, see . - - +;;;; base.scm -- core procedures +;;; Copyright © 2003 Dale Mellor +;;; Copyright © 2015, 2016 Mathieu Lirzin +;;; Copyright © 2016 Ludovic Courtès +;;; +;;; This file is part of GNU Mcron. +;;; +;;; GNU Mcron 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 Mcron 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 Mcron. If not, see . (define-module (mcron base) #:use-module (ice-9 match) diff --git a/src/mcron/config.scm.in b/src/mcron/config.scm.in index db2bc32..2b0bc7f 100644 --- a/src/mcron/config.scm.in +++ b/src/mcron/config.scm.in @@ -1,25 +1,21 @@ -;; -*-scheme-*- - -;; Copyright (C) 2015 Mathieu Lirzin -;; Copyright (C) 2003 Dale Mellor -;; -;; This file is part of GNU mcron. -;; -;; GNU mcron 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 mcron 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 mcron. If not, see . - - -;; Some constants set by the configuration process. +;;;; config.scm -- variables defined at configure time +;;; Copyright © 2003 Dale Mellor +;;; Copyright © 2015, 2016 Mathieu Lirzin +;;; +;;; This file is part of GNU Mcron. +;;; +;;; GNU Mcron 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 Mcron 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 Mcron. If not, see . (define-module (mcron config)) diff --git a/src/mcron/environment.scm b/src/mcron/environment.scm index b563d55..f6b9637 100644 --- a/src/mcron/environment.scm +++ b/src/mcron/environment.scm @@ -1,35 +1,35 @@ -;; Copyright (C) 2015, 2016 Mathieu Lirzin -;; Copyright (C) 2003 Dale Mellor -;; -;; This file is part of GNU mcron. -;; -;; GNU mcron 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 mcron 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 mcron. If not, see . - - - -;; This file defines the variable current-environment-mods, and the procedures -;; append-environment-mods (which is available to user configuration files), -;; clear-environment-mods and modify-environment. The idea is that the -;; current-environment-mods is a list of pairs of environment names and values, -;; and represents the cumulated environment settings in a configuration -;; file. When a job definition is seen in a configuration file, the -;; current-environment-mods are copied into the internal job description, and -;; when the job actually runs these environment modifications are applied to -;; the UNIX environment in which the job runs. - - - +;;;; environment.scm -- interact with the job process environment +;;; Copyright © 2003 Dale Mellor +;;; Copyright © 2015, 2016 Mathieu Lirzin +;;; +;;; This file is part of GNU Mcron. +;;; +;;; GNU Mcron 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 Mcron 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 Mcron. If not, see . + +;;;; Commentary: +;;; +;;; Define the variable current-environment-mods, and the procedures +;;; append-environment-mods (which is available to user configuration files), +;;; clear-environment-mods and modify-environment. The idea is that the +;;; current-environment-mods is a list of pairs of environment names and +;;; values, and represents the cumulated environment settings in a +;;; configuration file. When a job definition is seen in a configuration file, +;;; the current-environment-mods are copied into the internal job description, +;;; and when the job actually runs these environment modifications are applied +;;; to the UNIX environment in which the job runs. +;;; +;;;; Code: (define-module (mcron environment) #:export (modify-environment diff --git a/src/mcron/job-specifier.scm b/src/mcron/job-specifier.scm index 5d60484..d4c05bd 100644 --- a/src/mcron/job-specifier.scm +++ b/src/mcron/job-specifier.scm @@ -1,28 +1,30 @@ -;; Copyright (C) 2003 Dale Mellor -;; Copyright (C) 2016 Mathieu Lirzin -;; -;; This file is part of GNU mcron. -;; -;; GNU mcron 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 mcron 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 mcron. If not, see . - - +;;;; job-specifier.scm -- public interface for defining jobs +;;; Copyright © 2003 Dale Mellor +;;; Copyright © 2016 Mathieu Lirzin +;;; +;;; This file is part of GNU Mcron. +;;; +;;; GNU Mcron 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 Mcron 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 Mcron. If not, see . -;; This module defines all the functions that can be used by scheme mcron -;; configuration files, namely the procedures for working out next times, the -;; job procedure for registering new jobs (actually a wrapper around the -;; base add-job function), and the procedure for declaring environment -;; modifications. +;;;; Commentary: +;;; +;;; Define all the functions that can be used by scheme Mcron configuration +;;; files, namely the procedures for working out next times, the job procedure +;;; for registering new jobs (actually a wrapper around the base add-job +;;; function), and the procedure for declaring environment modifications. +;;; +;;;; Code: (define-module (mcron job-specifier) #:use-module (ice-9 match) diff --git a/src/mcron/main.scm b/src/mcron/main.scm index 1faa1ae..74b49e5 100644 --- a/src/mcron/main.scm +++ b/src/mcron/main.scm @@ -1,20 +1,21 @@ -;; Copyright (C) 2015, 2016 Mathieu Lirzin -;; Copyright (C) 2003, 2012 Dale Mellor -;; -;; This file is part of GNU mcron. -;; -;; GNU mcron 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 mcron 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 mcron. If not, see . +;;; main.scm -- helper procedures +;;; Copyright © 2003, 2012 Dale Mellor +;;; Copyright © 2015, 2016 Mathieu Lirzin +;;; +;;; This file is part of GNU Mcron. +;;; +;;; GNU Mcron 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 Mcron 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 Mcron. If not, see . (define-module (mcron main) #:use-module (ice-9 getopt-long) diff --git a/src/mcron/redirect.scm b/src/mcron/redirect.scm index af763cb..7474c4a 100644 --- a/src/mcron/redirect.scm +++ b/src/mcron/redirect.scm @@ -1,33 +1,36 @@ -;; Copyright (C) 2003 Dale Mellor -;; -;; This file is part of GNU mcron. -;; -;; GNU mcron 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 mcron 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 mcron. If not, see . - - - -;; This module provides the (with-mail-out action . user) procedure. This -;; procedure runs the action in a child process, allowing the user control over -;; the input and output (including standard error). The input is governed (only -;; in the case of a string action) by the placing of percentage signs in the -;; string; the first delimits the true action from the standard input, and -;; subsequent ones denote newlines to be placed into the input. The output (if -;; there actually is any) is controlled by the MAILTO environment variable. If -;; this is not defined, output is e-mailed to the user passed as argument, if -;; any, or else the owner of the action; if defined but empty then any output is -;; sunk to /dev/null; otherwise output is e-mailed to the address held in the -;; MAILTO variable. +;;;; redirect.scm -- modify job outputs +;;; Copyright © 2003 Dale Mellor +;;; +;;; This file is part of GNU Mcron. +;;; +;;; GNU Mcron 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 Mcron 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 Mcron. If not, see . + +;;;; Commentary: +;;; +;;; Provide the (with-mail-out action . user) procedure. This procedure runs +;;; the action in a child process, allowing the user control over the input +;;; and output (including standard error). The input is governed (only in the +;;; case of a string action) by the placing of percentage signs in the string; +;;; the first delimits the true action from the standard input, and subsequent +;;; ones denote newlines to be placed into the input. The output (if there +;;; actually is any) is controlled by the MAILTO environment variable. If +;;; this is not defined, output is e-mailed to the user passed as argument, if +;;; any, or else the owner of the action; if defined but empty then any output +;;; is sunk to /dev/null; otherwise output is e-mailed to the address held in +;;; the MAILTO variable. +;;; +;;;; Code: (define-module (mcron redirect) #:export (with-mail-out) diff --git a/src/mcron/vixie-specification.scm b/src/mcron/vixie-specification.scm index f055383..4356db7 100644 --- a/src/mcron/vixie-specification.scm +++ b/src/mcron/vixie-specification.scm @@ -1,27 +1,30 @@ -;; Copyright (C) 2003 Dale Mellor -;; -;; This file is part of GNU mcron. -;; -;; GNU mcron 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 mcron 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 mcron. If not, see . - - - -;; This file provides methods for reading a complete Vixie-style configuration -;; file, either from a real file or an already opened port. It also exposes the -;; method for parsing the time-specification part of a Vixie string, so that -;; these can be used to form the next-time-function of a job in a Guile -;; configuration file. +;;;; vixie-specification.scm -- read Vixie-sytle configuration file +;;; Copyright © 2003 Dale Mellor +;;; +;;; This file is part of GNU Mcron. +;;; +;;; GNU Mcron 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 Mcron 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 Mcron. If not, see . + +;;;; Commentary: +;;; +;;; Methods for reading a complete Vixie-style configuration file, either from +;;; a real file or an already opened port. It also exposes the method for +;;; parsing the time-specification part of a Vixie string, so that these can +;;; be used to form the next-time-function of a job in a Guile configuration +;;; file. +;;; +;;;; Code: (define-module (mcron vixie-specification) #:export (parse-user-vixie-line diff --git a/src/mcron/vixie-time.scm b/src/mcron/vixie-time.scm index a91fa89..f734600 100644 --- a/src/mcron/vixie-time.scm +++ b/src/mcron/vixie-time.scm @@ -1,19 +1,20 @@ -;; Copyright (C) 2003 Dale Mellor -;; -;; This file is part of GNU mcron. -;; -;; GNU mcron 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 mcron 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 mcron. If not, see . +;;;; vixie-time.scm -- parse Vixie-style times +;;; Copyright © 2003 Dale Mellor +;;; +;;; This file is part of GNU Mcron. +;;; +;;; GNU Mcron 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 Mcron 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 Mcron. If not, see . (define-module (mcron vixie-time) #:use-module (ice-9 regex) diff --git a/src/wrapper.c b/src/wrapper.c index a5b46db..bb7932e 100644 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -1,6 +1,6 @@ /* wrapper.c -- C code booting Guile - Copyright (C) 2003, 2014 Dale Mellor - Copyright (C) 2015, 2016 Mathieu Lirzin + Copyright © 2003, 2014 Dale Mellor + Copyright © 2015, 2016 Mathieu Lirzin This file is part of GNU Mcron. -- cgit v1.2.3