Look for user configuration files in $XDG_CONFIG_HOME (default to ~/.config/cron) as well as ~/.cron.
This commit is contained in:
parent
0115be5d13
commit
bd5a58ac2f
9 changed files with 115 additions and 58 deletions
|
|
@ -1,3 +1,12 @@
|
|||
2012-02-04 Dale Mellor <dale_mellor@users.sourceforge.net>
|
||||
|
||||
* main.scm: added search for initial files in
|
||||
$XDG_CONFIG_HOME/cron directory, defaulting to ~/.config/cron if
|
||||
the environment variable is not set) as well as in ~/.cron
|
||||
directory (this is in line with the current FreeDesktop.org
|
||||
standards).
|
||||
|
||||
|
||||
2010-06-13 Dale Mellor <dale_mellor@users.sourceforge.net>
|
||||
|
||||
* configure.ac: added --enable-no-vixie-clobber argument to
|
||||
|
|
|
|||
7
NEWS
7
NEWS
|
|
@ -10,6 +10,13 @@ Historic moments in the life of mcron. -*-text-*-
|
|||
Please send bug reports to bug-mcron@gnu.org.
|
||||
|
||||
|
||||
Saturday, 4th February 2012
|
||||
|
||||
Received a suggestion from Antono Vasiljev to look in FreeDesktop.org's
|
||||
standard user configuration directories for user script files. This is
|
||||
implemented in the GIT repository.
|
||||
|
||||
|
||||
Sunday, 20th June 2010
|
||||
|
||||
Standardized the copyright notices on all auxiliary files (including this
|
||||
|
|
|
|||
4
README
4
README
|
|
@ -1,13 +1,13 @@
|
|||
GNU mcron --- README -*-text-*-
|
||||
|
||||
Copyright (C) 2003, 2005, 2006 Dale Mellor
|
||||
Copyright (C) 2003, 2005, 2006, 2012 Dale Mellor
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved.
|
||||
|
||||
|
||||
This is version 1.0.6 of the GNU mcron program. It is designed and written by
|
||||
This is version 1.0.7 of the GNU mcron program. It is designed and written by
|
||||
Dale Mellor, and replaces and hugely enhances Vixie cron. It is functionally
|
||||
complete, production quality code (did you expect less?), but has not received
|
||||
much testing yet. It has only been built on a GNU/Linux system, and will most
|
||||
|
|
|
|||
23
README--git
Normal file
23
README--git
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
GNU mcron --- README--git -*-text-*-
|
||||
|
||||
Copyright (C) 2012 Dale Mellor
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved.
|
||||
|
||||
|
||||
If you have pulled mcron from the GIT repository, these are the steps you will
|
||||
need to take to build it the first time:
|
||||
|
||||
1) cp mcron.texinfo.in mcron.texinfo
|
||||
2) aclocal
|
||||
4) autoconf
|
||||
3) automake -a
|
||||
5) rm mcron.texinfo
|
||||
6) ./configure --prefix={wherever}
|
||||
7) make install
|
||||
|
||||
|
||||
After that it should just be a simple matter of typing `make install' when you
|
||||
want to build a version with changes in it.
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
|
||||
# Copyright (C) 2003, 2005 Dale Mellor
|
||||
# Copyright (C) 2003, 2005, 2012 Dale Mellor
|
||||
#
|
||||
# This file is part of GNU mcron.
|
||||
#
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
|
||||
AC_PREREQ(2.61)
|
||||
AC_INIT([mcron], [1.0.6], [dale_mellor@users.sourceforge.net])
|
||||
AC_INIT([mcron], [1.0.7], [dale_mellor@users.sourceforge.net])
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
|
||||
|
|
|
|||
56
main.scm
56
main.scm
|
|
@ -1,4 +1,4 @@
|
|||
;; Copyright (C) 2003 Dale Mellor
|
||||
;; Copyright (C) 2003, 2012 Dale Mellor
|
||||
;;
|
||||
;; This file is part of GNU mcron.
|
||||
;;
|
||||
|
|
@ -150,14 +150,14 @@ Usage: " (car (command-line))
|
|||
((mcron)
|
||||
" [OPTIONS] [FILES]\n
|
||||
Run an mcron process according to the specifications in the FILES (`-' for\n
|
||||
standard input), or use all the files in ~/.cron with .guile or .vixie\n
|
||||
extensions.\n
|
||||
standard input), or use all the files in ~/.config/cron (or the \n
|
||||
deprecated ~/.cron) with .guile or .vixie extensions.\n
|
||||
\n
|
||||
-v, --version Display version\n
|
||||
-h, --help Display this help message\n
|
||||
-sN, --schedule[=]N Display the next N jobs that will be run by mcron\n
|
||||
-d, --daemon Immediately detach the program from the terminal and\n
|
||||
run as a daemon process\n
|
||||
-d, --daemon Immediately detach the program from the terminal\n
|
||||
and run as a daemon process\n
|
||||
-i, --stdin=(guile|vixie) Format of data passed as standard input or\n
|
||||
file arguments (default guile)")
|
||||
|
||||
|
|
@ -296,22 +296,32 @@ Report bugs to " config-package-bugreport ".\n
|
|||
|
||||
|
||||
|
||||
;; Procedure to run through all the files in a user's ~/.cron directory (only
|
||||
;; happens under the mcron personality).
|
||||
;; Procedure to run through all the files in a user's ~/.cron and/or
|
||||
;; $XDG_CONFIG_HOME/cron or ~/.config/cron directories (only happens under the
|
||||
;; mcron personality).
|
||||
|
||||
(define (process-files-in-user-directory)
|
||||
(catch #t (lambda ()
|
||||
(let* ((dir-path (string-append (passwd:dir (getpw (getuid)))
|
||||
"/.cron"))
|
||||
(directory (opendir dir-path)))
|
||||
(do ((file-name (readdir directory) (readdir directory)))
|
||||
((eof-object? file-name) (closedir directory))
|
||||
(process-user-file (string-append dir-path
|
||||
"/"
|
||||
file-name)))))
|
||||
(lambda (key . args)
|
||||
(mcron-error 13 "Cannot read files in your ~/.cron directory."))))
|
||||
|
||||
(let ((errors 0)
|
||||
(home-directory (passwd:dir (getpw (getuid)))))
|
||||
(map (lambda (config-directory)
|
||||
(catch #t
|
||||
(lambda ()
|
||||
(let ((directory (opendir config-directory)))
|
||||
(do ((file-name (readdir directory) (readdir directory)))
|
||||
((eof-object? file-name) (closedir directory))
|
||||
(process-user-file (string-append config-directory
|
||||
"/"
|
||||
file-name)))))
|
||||
(lambda (key . args)
|
||||
(set! errors (1+ errors)))))
|
||||
(list (string-append home-directory "/.cron")
|
||||
(string-append (or (getenv "XDG_CONFIG_HOME")
|
||||
(string-append home-directory "/.config"))
|
||||
"/cron")))
|
||||
(if (eq? 2 errors)
|
||||
(mcron-error 13
|
||||
"Cannot read files in your ~/.config/cron (or ~/.cron) "
|
||||
"directory."))))
|
||||
|
||||
|
||||
|
||||
|
|
@ -361,9 +371,9 @@ Report bugs to " config-package-bugreport ".\n
|
|||
;; Having defined all the necessary procedures for scanning various sets of
|
||||
;; files, we perform the actual configuration of the program depending on the
|
||||
;; personality we are running as. If it is mcron, we either scan the files
|
||||
;; passed on the command line, or else all the ones in the user's .cron
|
||||
;; directory. If we are running under the cron personality, we read the
|
||||
;; /var/cron/tabs directory and also the /etc/crontab file.
|
||||
;; passed on the command line, or else all the ones in the user's .config/cron
|
||||
;; (or .cron) directory. If we are running under the cron personality, we read
|
||||
;; the /var/cron/tabs directory and also the /etc/crontab file.
|
||||
|
||||
(case command-type
|
||||
((mcron) (if (null? (option-ref options '() '()))
|
||||
|
|
@ -380,7 +390,7 @@ Report bugs to " config-package-bugreport ".\n
|
|||
(if (not (option-ref options 'noetc #f))
|
||||
(begin
|
||||
(display
|
||||
"WARNING: cron will check for updates to /etc/crontab EVERY MINUTE. If you do\n
|
||||
"WARNING: cron will check for updates to /etc/crontab EVERY MINUTE. If you do\n
|
||||
not use this file, or you are prepared to manually restart cron whenever you\n
|
||||
make a change, then it is HIGHLY RECOMMENDED that you use the --noetc\n
|
||||
option.\n")
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ pkgdata_DATA = core.scm environment.scm job-specifier.scm redirect.scm \
|
|||
# like core.*, so we have to keep re-making it (I lost a good day's work because
|
||||
# of this).
|
||||
|
||||
mcron : mcron.c
|
||||
$(CC) $(AM_CFLAGS) mcron.c -o mcron $(AM_LDFLAGS)
|
||||
|
||||
core.scm : mcron-core.scm
|
||||
$(CP) mcron-core.scm core.scm
|
||||
|
||||
|
|
|
|||
14
mcron.1
14
mcron.1
|
|
@ -1,5 +1,5 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
|
||||
.TH MCRON "1" "June 2010" "mcron " "User Commands"
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.4.
|
||||
.TH MCRON "1" "February 2012" "mcron " "User Commands"
|
||||
.SH NAME
|
||||
mcron \- a program to run tasks at regular (or not) intervals
|
||||
.SH SYNOPSIS
|
||||
|
|
@ -7,8 +7,8 @@ mcron \- a program to run tasks at regular (or not) intervals
|
|||
[\fIOPTIONS\fR] [\fIFILES\fR]
|
||||
.SH DESCRIPTION
|
||||
Run an mcron process according to the specifications in the FILES (`\-' for
|
||||
standard input), or use all the files in ~/.cron with .guile or .vixie
|
||||
extensions.
|
||||
standard input), or use all the files in ~/.config/cron (or the
|
||||
deprecated ~/.cron) with .guile or .vixie extensions.
|
||||
.TP
|
||||
\fB\-v\fR, \fB\-\-version\fR
|
||||
Display version
|
||||
|
|
@ -20,8 +20,8 @@ Display this help message
|
|||
Display the next N jobs that will be run by mcron
|
||||
.TP
|
||||
\fB\-d\fR, \fB\-\-daemon\fR
|
||||
Immediately detach the program from the terminal and
|
||||
run as a daemon process
|
||||
Immediately detach the program from the terminal
|
||||
and run as a daemon process
|
||||
.TP
|
||||
\fB\-i\fR, \fB\-\-stdin=\fR(guile|vixie) Format of data passed as standard input or
|
||||
file arguments (default guile)
|
||||
|
|
@ -30,7 +30,7 @@ Written by Dale Mellor
|
|||
.SH "REPORTING BUGS"
|
||||
Report bugs to dale_mellor@users.sourceforge.net.
|
||||
.PP
|
||||
mcron (mcron 1.0.6)
|
||||
mcron (mcron 1.0.7)
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2003, 2006 Dale Mellor
|
||||
.br
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
@copying This manual is for GNU mcron (version @VERSION@), which is a
|
||||
program for running jobs at scheduled times.
|
||||
|
||||
Copyright @copyright{} 2003, 2005, 2006 Dale Mellor
|
||||
Copyright @copyright{} 2003, 2005, 2006, 2012 Dale Mellor
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
|
|
@ -192,8 +192,10 @@ how to run mcron to make them happen.
|
|||
@cindex examples, guile
|
||||
@cindex example, run a program every hour
|
||||
You have an executable @code{my-program} in your home directory, which
|
||||
you want to run every hour. Create a file @code{job.guile} in directory
|
||||
@code{~/.cron} with the following contents
|
||||
you want to run every hour. Create a file @code{job.guile} in
|
||||
directory @code{~/.config/cron} (this path may be altered by the
|
||||
@code{$XDG_CONFIG_HOME} environment variable) with the following
|
||||
contents
|
||||
|
||||
@example
|
||||
(job '(next-hour) "my-program")
|
||||
|
|
@ -224,7 +226,7 @@ also the next section)
|
|||
and run the @code{mcron} command.
|
||||
|
||||
If you want to run other jobs, you can either add more lines to this
|
||||
file, or you can create other files in your @code{.cron} directory
|
||||
file, or you can create other files in your @code{.config/cron} directory
|
||||
with the @code{.guile} extension. Alternatively, you can use any file
|
||||
you want and pass it as an argument to @code{mcron}, or even pipe the
|
||||
commands into the standard input.
|
||||
|
|
@ -808,26 +810,28 @@ place in the part which implements the mcron personality.
|
|||
@cindex mcron arguments
|
||||
@cindex command line, mcron
|
||||
@cindex mcron command line
|
||||
Mcron should be run by the user who wants to schedule his jobs. It may
|
||||
be made a background job using the facilities of the shell. The basic
|
||||
command is
|
||||
@code{mcron [OPTION ...] [file ...]}
|
||||
which has the effect of reading all the configuration files specified
|
||||
(subject to the options) and then waiting until it is time to execute
|
||||
some command. If no files are given on the command line, then mcron
|
||||
will look in the user's ~/.cron directory. In either case, files which
|
||||
end in the extension .vixie or .vix will be assumed to contain
|
||||
Vixie-style crontabs, and files ending .guile or .gle will be assumed
|
||||
to contain scheme code and will be executed as such; ANY OTHER FILES
|
||||
WILL BE IGNORED - specify a file name of ``-'' and then pipe the files
|
||||
into the standard input if you really want to read them, possibly
|
||||
using the @code{stdin} option to specify the type of file.
|
||||
Mcron should be run by the user who wants to schedule his jobs. It
|
||||
may be made a background job using the facilities of the shell. The
|
||||
basic command is @code{mcron [OPTION ...] [file ...]} which has the
|
||||
effect of reading all the configuration files specified (subject to
|
||||
the options) and then waiting until it is time to execute some
|
||||
command. If no files are given on the command line, then mcron will
|
||||
look in the user's cron configuration directories: these are ~/.cron
|
||||
(deprecated), the directory indicated by the @code{XDG_CONFIG_HOME}
|
||||
environment variable, or ~/.config/cron if this variable is not set.
|
||||
In any case, files which end in the extension .vixie or .vix will be
|
||||
assumed to contain Vixie-style crontabs, and files ending .guile or
|
||||
.gle will be assumed to contain scheme code and will be executed as
|
||||
such; ANY OTHER FILES WILL BE IGNORED - specify a file name of ``-''
|
||||
and then pipe the files into the standard input if you really want to
|
||||
read them, possibly using the @code{stdin} option to specify the type
|
||||
of file.
|
||||
|
||||
The program accepts the following options.
|
||||
|
||||
@table @option
|
||||
@item -s [count]
|
||||
@itemx --schedule[=count]
|
||||
@item -s count
|
||||
@itemx --schedule=count
|
||||
@cindex printout of jobs schedule
|
||||
@cindex schedule of jobs, listing
|
||||
@cindex options, schedule
|
||||
|
|
@ -838,8 +842,7 @@ With this option specified no commands are run. Instead, the program
|
|||
computes the times the commands would be run and prints the
|
||||
information to the screen, and then immediately exits.
|
||||
|
||||
The count, if supplied, indicates the number of commands to
|
||||
display. The default value is 8.
|
||||
The count indicates the number of commands to display.
|
||||
|
||||
@cindex daemon option
|
||||
@cindex options, daemon
|
||||
|
|
@ -1109,8 +1112,10 @@ The last component of the name of the program was not one of
|
|||
@code{mcron}, @code{cron}, @code{crond} or @code{crontab}.
|
||||
|
||||
@item 13
|
||||
Either the ~/.cron directory does not exist, or there is a problem
|
||||
reading the files there.
|
||||
Either none of the user's configuration directories exist, or there is a problem
|
||||
reading the files there. The configuration directories are ~/.cron
|
||||
and the directory pointed to by the @code{XDG_CONFIG_HOME} environment
|
||||
variable, or ~/.config/cron if this is not set.
|
||||
|
||||
@c @item 14
|
||||
@c There is a problem writing to /var/cron/update. This is probably
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue