This is the version 1.0.0 release (many changes have occurred without commiting due to disruption to Savannah, including a skip over the 0.99.4 release).

This commit is contained in:
dale_mellor 2004-01-22 13:54:21 +00:00
commit 627e81918e
11 changed files with 230 additions and 81 deletions

View file

@ -1,3 +1,27 @@
2003-12-11 Dale Mellor <dale_mellor@users.sourceforge.net>
* Modified all auxiliary files to reflect that we are now a GNU
package.
* Bumped version to 1.0.0.
2003-12-07 Dale Mellor <dale_mellor@users.sourceforge.net>
* configure.ac: Added switches for files and directories used by
mcron: --spool-dir, --socket-file, --allow-file, --deny-file,
--pid-file and --tmp-dir. All the code has been modified to use
these configure options (including the source for the texinfo
manual).
2003-12-05 Dale Mellor <dale_mellor@users.sourceforge.net>
* configure.ac: Added test for guile version >= 1.6.4.
* bumped version to 0.99.4.
2003-08-03 Dale Mellor <dale_mellor@users.sourceforge.net>
* Third cut, fully functional, modular, production quality, still

28
NEWS
View file

@ -3,7 +3,26 @@ Historic moments in the life of mcron. -*-text-*-
Copyright (C) 2003 Dale Mellor
See the end for copying conditions.
Please send bug reports to dale_mellor@users.sourceforge.net.
Please send bug reports to bugs-mcron@gnu.org.
Friday, 12th December 2003
Released version 1.0.0 through rdmp.org. No CVS tag has been created.
Tuesday, 2nd December 2003
Mcron is now officially a GNU program. Unfortunately Savannah, the
development environment, has been mauled so an immediate GNU release is not
likely. No CVS tag has been created.
Tuesday, 5th August 2003
Released version 0.99.3. The CVS tag will be release_0-99-3 (no branch).
Sunday, 3rd August 2003
Broken the code into modules (which is not the same as saying the code is
broken ;-) ).
Sunday, 20th July 2003
@ -20,13 +39,14 @@ Sunday, 20th July 2003
Saturday, 5th July 2003
Released version 0.99.1, with installation of cron and crontab disabled by
default (suspect problems with Guile internals are preventing these from
working properly). The CVS tag is release_0-99-1 (no branch has been created
for it).
working properly). The CVS tag is release_0-99-1 (no branch has been
created for it).
Friday, 4th July 2003
We have been accepted as a Savannah project. A CVS repository and web home
page have been created. We're still waiting for acceptance as a GNU project.
page have been created. We're still waiting for acceptance as a GNU
project.

62
README
View file

@ -2,11 +2,11 @@ Copyright (C) 2003 Dale Mellor -*-text-*-
See the end for copying conditions.
This is version 0.99.3 of the mcron program (the third 1.0.0 release
candidate), designed and written by Dale Mellor, which 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 likely fail on others (but you never
This is version 1.0.0 of the mcron program, and is the first release as part of
the GNU system. 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 likely fail on others (but you never
know...).
@ -15,8 +15,8 @@ IMPORTANT NOTICES
Read the BUGS file.
Do not (yet) install this software on a machine which relies for its functioning
on its current set of crontabs.
Do not (yet) install this software on a machine which relies for its
functioning on its current set of crontabs.
The package must be installed by root.
@ -24,41 +24,49 @@ Before installing this package for the first time, it is necessary to terminate
any running cron daemons on your system. If your old cron is not Vixie or
accurately Vixie compatible (files in /var/cron/tabs*, /var/cron/allow,
/var/cron/deny, /etc/crontab, /var/run/cron.pid) then you will need to clear out
all old crontabs and make new ones afresh.
all old crontabs and make new ones afresh - or else look very carefully at the
options you pass to the package configure script, as follows.
It is often the case that GNU/Linux distributions and other Unices hacked the
cron daemon to use different directories to those above. You can use configure
options --spool-dir, --socket-file, --allow-file, --deny-file, --pid-file and
--tmp-dir to make mcron behave similarly. Note that, with the exception of
tmp-dir, none of these files or directories should be accessible by ordinary
(non-root) users.
If your old cron is Vixie, or very similar, mcron should fall right into place
where your old cron was (the binaries cron and crontab will be replaced), and
you should be able to continue to use your existing crontabs without noticing
any changes. Bear in mind that if you use /etc/crontab, then changes to this
file will *not* take immediate effect (this is the 1% incompatibility between
mcron and Vixie cron); you may want to add a comment to this file with a note to
this effect. Alternatively, use the new mcron program, it's better!
where your old cron was (the binaries cron and crontab will be replaced, but if
your existing system has a binary called crond, you should make this a link
to mcron), and you should be able to continue to use your existing crontabs
without noticing any changes.
If you don't want to clobber your existing cron executables, you can specify the
--program-prefix option to configure with a prefix ending in a non-alphabetic
character, for example "m.", and then run the programs as m.mcron, m.cron and
m.crontab.
If you don't want to clobber your existing cron executables, you can specify
the --program-prefix option to configure with a prefix ending in a
non-alphabetic character, for example "m.", and then run the programs as
m.mcron, m.cron (or m.crond) and m.crontab.
----------------------------------------------------------------------
See the file INSTALL for generic building and installation instructions.
After installation, read the info file for full instructions for use (type
`info mcron' at the command line). Notes for end users, sysadmins, and
developers who wish to incorporate mcron into their own programs are included
here.
After installation, read the info file for full instructions for use (typing
`info mcron' at the command line should suffice). Notes for end users,
sysadmins, and developers who wish to incorporate mcron into their own programs
are included here.
Known bugs are noted in the BUGS file, and features which might be implemented
sometime sooner or later are noted in the TODO file.
Please send all other bug reports either via Savannah (preferred) at
https://savannah.nongnu.org/bugs/?func=addbug&group=mcron
or else by electronic mail to:
dale_mellor@users.sourceforge.net
Please send all other bug reports to bugs-mcron@gnu.org. Other mailing lists you
could subscribe to are help-mcron@gnu.org (for help and advice from the
community, including the author) and info-mcron@gnu.org (for news as it
happens).
Mcron is free software. See the file COPYING for copying conditions.
The mcron development home page is at http://www.nongnu.org/mcron.
The mcron development home page is at http://www.gnu.org/software/mcron (also
temporarily at http://rdmp.org/mcron), and can be obtained from
ftp://ftp.gnu.org/mcron (or temporarily from ftp://rdmp.org/mcron).

View file

@ -26,3 +26,10 @@
(define-public config-package-string "@PACKAGE_STRING@")
(define-public config-package-bugreport "@PACKAGE_BUGREPORT@")
(define-public config-sendmail "@SENDMAIL@")
(define-public config-spool-dir "@CONFIG_SPOOL_DIR@")
(define-public config-socket-file "@CONFIG_SOCKET_FILE@")
(define-public config-allow-file "@CONFIG_ALLOW_FILE@")
(define-public config-deny-file "@CONFIG_DENY_FILE@")
(define-public config-pid-file "@CONFIG_PID_FILE@")
(define-public config-tmp-dir "@CONFIG_TMP_DIR@")

View file

@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
AC_INIT(mcron, 0.99.3, dale_mellor@users.sourceforge.net)
AC_INIT(mcron, 1.0.0, dale_mellor@users.sourceforge.net)
AM_INIT_AUTOMAKE
@ -21,12 +21,24 @@ fi
AC_SUBST(CONFIG_DEBUG)
AC_PROG_AWK
AC_PROG_EGREP
AC_PROG_CC
GUILE_PROGS
GUILE_FLAGS
GUILE_SITE_DIR
# Checks for programs.
AC_CHECK_PROGS(SED, sed)
if test "x$ac_cv_prog_SED" = "x"; then
AC_MSG_ERROR(sed not found)
fi
AC_CHECK_PROGS(HEAD, head)
if test "x$ac_cv_prog_HEAD" = "x"; then
AC_MSG_ERROR(head not found)
fi
AC_CHECK_PROGS(ED, ed)
if test "x$ac_cv_prog_ED" = "x"; then
AC_MSG_ERROR(ed not found)
@ -40,7 +52,18 @@ if test "x$ac_cv_prog_CP" = "x"; then
AC_MSG_ERROR(cp not found)
fi
# Check the Guile version.
AC_MSG_CHECKING(for guile version >= 1.6.4)
if [$GUILE --version | $HEAD -1 | $AWK '{print $2}' | \
$EGREP -q '^(1\.(6\.([4-9]|[1-3][^.])|[7-9]|[1-5][^.])|[2-9])']; then
AC_MSG_RESULT(OK)
else
AC_MSG_ERROR([Sorry, Guile 1.6.4 or greater is needed to run mcron])
fi
# Now find a sendmail or equivalent.
AC_CHECK_PROGS(SENDMAIL, sendmail)
@ -63,11 +86,70 @@ fi
SENDMAIL=$ac_cv_prog_SENDMAIL
# Configure the various files that mcron uses at runtime.
AC_MSG_CHECKING([which spool directory to use])
AC_ARG_WITH(spool-dir,
AC_HELP_STRING([--with-spool-dir],
[the crontab spool directory (/var/cron/tabs)]),
CONFIG_SPOOL_DIR=$withval,
CONFIG_SPOOL_DIR=[/var/cron/tabs])
AC_MSG_RESULT($CONFIG_SPOOL_DIR)
AC_SUBST(CONFIG_SPOOL_DIR)
AC_MSG_CHECKING([name of socket])
AC_ARG_WITH(socket-file,
AC_HELP_STRING([--with-socket-file],
[unix pathname for cron socket (/var/cron/socket)]),
CONFIG_SOCKET_FILE=$withval,
CONFIG_SOCKET_FILE=[/var/cron/socket])
AC_MSG_RESULT($CONFIG_SOCKET_FILE)
AC_SUBST(CONFIG_SOCKET_FILE)
AC_MSG_CHECKING([name of allow file])
AC_ARG_WITH(allow-file,
AC_HELP_STRING([--with-allow-file],
[the file of allowed users (/var/cron/allow)]),
CONFIG_ALLOW_FILE=$withval,
CONFIG_ALLOW_FILE=[/var/cron/allow])
AC_MSG_RESULT($CONFIG_ALLOW_FILE)
AC_SUBST(CONFIG_ALLOW_FILE)
AC_MSG_CHECKING([name of deny file])
AC_ARG_WITH(deny-file,
AC_HELP_STRING([--with-deny-file],
[the file of barred users (/var/cron/deny)]),
CONFIG_DENY_FILE=$withval,
CONFIG_DENY_FILE=[/var/cron/deny])
AC_MSG_RESULT($CONFIG_DENY_FILE)
AC_SUBST(CONFIG_DENY_FILE)
AC_MSG_CHECKING([name of PID file])
AC_ARG_WITH(pid-file,
AC_HELP_STRING([--with-pid-file],
[the file to record cron's PID (/var/run/cron.pid)]),
CONFIG_PID_FILE=$withval,
CONFIG_PID_FILE=[/var/run/cron.pid])
AC_MSG_RESULT($CONFIG_PID_FILE)
AC_SUBST(CONFIG_PID_FILE)
AC_MSG_CHECKING([directory to hold temporary files])
AC_ARG_WITH(tmp-dir,
AC_HELP_STRING([--with-tmp-dir],
[directory to hold temporary files (/tmp)]),
CONFIG_TMP_DIR=$withval,
CONFIG_TMP_DIR=[/tmp])
AC_MSG_RESULT($CONFIG_TMP_DIR)
AC_SUBST(CONFIG_TMP_DIR)
# This is to support `make DESTDIR=...'
real_program_prefix=`echo $program_prefix | sed s/NONE//`
AC_SUBST(real_program_prefix)
AC_CONFIG_FILES(makefile config.scm)
AC_CONFIG_FILES(makefile config.scm mcron.texinfo)
AC_OUTPUT

View file

@ -29,8 +29,8 @@
(define (hit-server user-name)
(catch #t (lambda ()
(let* ((socket (socket AF_UNIX SOCK_STREAM 0)))
(connect socket AF_UNIX "/var/cron/socket")
(let ((socket (socket AF_UNIX SOCK_STREAM 0)))
(connect socket AF_UNIX config-socket-file)
(display user-name socket)
(close socket)))
(lambda (key . args)
@ -65,8 +65,8 @@
;; If the real user is not allowed to use crontab due to the /var/cron/allow
;; and/or /var/cron/deny files, bomb out now.
(if (or (eq? (in-access-file? "/var/cron/allow" crontab-real-user) #f)
(eq? (in-access-file? "/var/cron/deny" crontab-real-user) #t))
(if (or (eq? (in-access-file? config-allow-file crontab-real-user) #f)
(eq? (in-access-file? config-deny-file crontab-real-user) #t))
(begin
(display "Access denied by system operator.\n")
(primitive-exit 6)))
@ -103,7 +103,7 @@
;; So now we know which crontab file we will be manipulating.
(define crontab-file (string-append "/var/cron/tabs/" crontab-user))
(define crontab-file (string-append config-spool-dir "/" crontab-user))
@ -139,7 +139,9 @@
;; crontab, wake the cron daemon up, and remove the temporary file.
((option-ref options 'edit #f)
(let ((temp-file (string-append "/tmp/crontab." (number->string (getpid)))))
(let ((temp-file (string-append config-tmp-dir
"/crontab."
(number->string (getpid)))))
(catch #t (lambda () (copy-file crontab-file temp-file))
(lambda (key . args) (with-output-to-file temp-file noop)))
(chown temp-file (getuid) (getgid))

View file

@ -24,8 +24,8 @@
;; 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.
;; when the job actually runs these environment modifications are applied to
;; the UNIX environment in which the job runs.
@ -76,8 +76,8 @@
;; Each time a job is added to the system, we take a snapshot of the current set
;; of environment modifiers.
;; Each time a job is added to the system, we take a snapshot of the current
;; set of environment modifiers.
(define (get-current-environment-mods-copy)
(list-copy current-environment-mods))
@ -93,10 +93,11 @@
;; Procedure to add another environment setting to the alist above. This is used
;; both implicitly by the Vixie parser, and can be used directly by users in
;; scheme configuration files. The return value is purely for the convenience of
;; the parse-vixie-environment in the vixie-specification module (yuk).
;; Procedure to add another environment setting to the alist above. This is
;; used both implicitly by the Vixie parser, and can be used directly by users
;; in scheme configuration files. The return value is purely for the
;; convenience of the parse-vixie-environment in the vixie-specification module
;; (yuk).
(define (append-environment-mods name value)
(set! current-environment-mods (append current-environment-mods

View file

@ -162,8 +162,8 @@ Report bugs to " config-package-bugreport ".\n
;; running.
(define (delete-run-file)
(catch #t (lambda () (delete-file "/var/run/cron.pid")
(delete-file "/var/cron/socket"))
(catch #t (lambda () (delete-file config-pid-file)
(delete-file config-socket-file))
noop)
(quit))
@ -187,14 +187,14 @@ Report bugs to " config-package-bugreport ".\n
(display "This program must be run by the root user (and should ")
(display "have been installed as such).\n")
(primitive-exit 16)))
(if (access? "/var/run/cron.pid" F_OK)
(if (access? config-pid-file F_OK)
(begin
(display "A cron daemon is already running.\n")
(display " (If you are sure this is not true, remove the file\n")
(display " /var/run/cron.pid.)\n")
(display " " config-pid-file ".)\n")
(primitive-exit 1)))
(if (not (option-ref options 'schedule #f))
(with-output-to-file "/var/run/cron.pid" noop))
(with-output-to-file config-pid-file noop))
(setenv "MAILTO" #f)
(c-set-cron-signals)))
@ -294,12 +294,12 @@ Report bugs to " config-package-bugreport ".\n
(define (process-files-in-system-directory)
(catch #t (lambda ()
(let ((directory (opendir "/var/cron/tabs")))
(let ((directory (opendir config-spool-dir)))
(do ((file-name (readdir directory) (readdir directory)))
((eof-object? file-name))
(and-let* ((user (valid-user file-name)))
(set-configuration-user user)
(read-vixie-file (string-append "/var/cron/tabs/"
(read-vixie-file (string-append config-spool-dir
file-name))))))
(lambda (key . args)
(display "You do not have permission to access the system crontabs.\n")
@ -366,7 +366,7 @@ option.\n")
(quit))
(setsid)
(if (eq? command-type 'cron)
(with-output-to-file "/var/run/cron.pid"
(with-output-to-file config-pid-file
(lambda () (display (getpid)) (newline))))))
@ -380,7 +380,7 @@ option.\n")
(if (eq? command-type 'cron)
(let ((socket (socket AF_UNIX SOCK_STREAM 0)))
(bind socket AF_UNIX "/var/cron/socket")
(bind socket AF_UNIX config-socket-file)
(listen socket 5)
(set! fd-list (list socket))))
@ -406,7 +406,7 @@ option.\n")
(let ((user (getpw user-name)))
(remove-user-jobs user)
(set-configuration-user user)
(read-vixie-file (string-append "/var/cron/tabs/" user-name))))))
(read-vixie-file (string-append config-spool-dir "/" user-name))))))

View file

@ -40,10 +40,9 @@
;;
;; (vector user next-time-function action environment displayable next-time)
;;
;; where action may be a string (indicating a shell command) or a list
;; (indicating scheme code) or a procedure, and the environment is an alist of
;; 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 elements is the only one that is modified during the
;; 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).
;;
@ -158,16 +157,16 @@
;; If the user has requested a schedule of jobs that will run, we provide the
;; information here and then get out.
;; Create a string containing a textual list of the next count jobs to run.
;;
;; Start by determining the number of time points in the future that output is
;; required for. This may be provided on the command line as a parameter to the
;; --schedule option, or else we assume a default of 8. Having determined this
;; count we enter a loop of displaying the next set of jobs to run, artificially
;; 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
@ -219,6 +218,12 @@
;; 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)

View file

@ -172,13 +172,13 @@ concerns that surround all existing cron programs.
The user can obtain an advance schedule of all the jobs that are due
to run.
@item
Vixie cron is implemented in 4500 lines of C code; mcron is 1500 lines
Vixie cron is implemented in 4500 lines of C code; mcron is 2000 lines
of scheme, despite the fact that it offers many more features and much
more flexibility, and complete compatibility with Vixie cron.
@end itemize
A full discussion of the design and philosophy of mcron can be found
in the white paper at http://.../mcron.html [FIXME].
in the white paper at http://rdmp.org:20202/mcron.html.
@node Simple examples, Syntax, Introduction, Top
@ -899,14 +899,14 @@ standard output.
@cindex running cron
@cindex crond, invokation
@cindex running crond
@cindex /var/cron/tabs
@cindex /var/run/cron.pid
@cindex @CONFIG_SPOOL_DIR@
@cindex @CONFIG_SOCKET_FILE@
If the program runs by the name of @code{cron} or @code{crond}, then
it will read all the files in @code{/var/cron/tabs} (which should only
it will read all the files in @code{@CONFIG_SPOOL_DIR@} (which should only
be readable by root) and the file @code{/etc/crontab}, and then
detaches itself from the terminal to live forever as a daemon
process. Additionally, it creates a UNIX socket at
@code{/var/cron/socket}, and listens for messages sent to that socket
@code{@CONFIG_SOCKET_FILE@}, and listens for messages sent to that socket
consisting of a user name whose crontabs have been changed. In this
case, the program will re-read that user's crontab. This is for
correct functioning with the crontab program.
@ -1047,7 +1047,7 @@ No problems.
@item 1
An attempt has been made to start cron but there is already a
/var/run/cron.pid file. If there really is no other cron daemon
@CONFIG_PID_FILE@ file. If there really is no other cron daemon
running (this does not include invokations of mcron) then you should
remove this file before attempting to run cron.
@ -1065,7 +1065,7 @@ to be specified in one of these forms.
@item 4
An attempt to run cron has been made by a user who does not have
permission to access the crontabs in /var/cron/tabs. These files
permission to access the crontabs in @CONFIG_SPOOL_DIR@. These files
should be readable only by root, and the cron daemon must be run as
root.
@ -1075,7 +1075,7 @@ schedule!
@item 6
The system administrator has blocked this user from using crontab with
the files /var/cron/allow and /var/cron/deny.
the files @CONFIG_ALLOW_FILE@ and @CONFIG_DENY_FILE@.
@item 7
Crontab has been run with more than one of the arguments @code{-l},
@ -1102,10 +1102,10 @@ The last component of the name of the program was not one of
Either the ~/.cron directory does not exist, or there is a problem
reading the files there.
@item 14
There is a problem writing to /var/cron/update. This is probably
because the crontab program is not installed SUID root, as it should
be.
@c @item 14
@c There is a problem writing to /var/cron/update. This is probably
@c because the crontab program is not installed SUID root, as it should
@c be.
@item 15
Crontab has been run without any arguments at all. There is no default

View file

@ -186,6 +186,6 @@
(let ((mtime (stat:mtime (stat "/etc/crontab"))))
(if (> mtime (- (current-time) 60))
(let ((socket (socket AF_UNIX SOCK_STREAM 0)))
(connect socket AF_UNIX "/var/cron/socket")
(connect socket AF_UNIX config-socket-file)
(display "/etc/crontab" socket)
(close socket)))))))