Now runs (only) against guile-2.0.
This commit is contained in:
parent
bd5a58ac2f
commit
c45e7c447b
12 changed files with 112 additions and 163 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -3,6 +3,7 @@
|
|||
INSTALL
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
compile
|
||||
config.log
|
||||
config.scm
|
||||
config.status
|
||||
|
|
@ -15,7 +16,7 @@ makefile.in
|
|||
mcron
|
||||
mcron.c
|
||||
mcron.info
|
||||
mcron.o
|
||||
*.o
|
||||
mcron.texinfo
|
||||
missing
|
||||
texinfo.tex
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
2014-04-28 Dale Mellor <dale_mellor@users.sourceforge.net>
|
||||
|
||||
* We now run against, and require, guile-2.0.
|
||||
|
||||
|
||||
2012-02-04 Dale Mellor <dale_mellor@users.sourceforge.net>
|
||||
|
||||
* main.scm: added search for initial files in
|
||||
|
|
|
|||
4
README
4
README
|
|
@ -1,13 +1,13 @@
|
|||
GNU mcron --- README -*-text-*-
|
||||
|
||||
Copyright (C) 2003, 2005, 2006, 2012 Dale Mellor
|
||||
Copyright (C) 2003, 2005, 2006, 2012, 2014 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.7 of the GNU mcron program. It is designed and written by
|
||||
This is version 1.0.8 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
|
||||
|
|
|
|||
12
README--git
12
README--git
|
|
@ -1,6 +1,6 @@
|
|||
GNU mcron --- README--git -*-text-*-
|
||||
|
||||
Copyright (C) 2012 Dale Mellor
|
||||
Copyright (C) 2012, 2014 Dale Mellor
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
|
|
@ -10,11 +10,11 @@ GNU mcron --- README--git -*-text-*-
|
|||
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
|
||||
1) aclocal
|
||||
2) autoconf
|
||||
3) automake -a (will error)
|
||||
4) ./configure (will error)
|
||||
5) automake -a
|
||||
6) ./configure --prefix={wherever}
|
||||
7) make install
|
||||
|
||||
|
|
|
|||
4
TODO
4
TODO
|
|
@ -1,6 +1,6 @@
|
|||
GNU mcron --- TODO -*-text-*-
|
||||
|
||||
Copyright (C) 2003, 2005, 2006 Dale Mellor
|
||||
Copyright (C) 2003, 2005, 2006, 2014 Dale Mellor
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
|
|
@ -45,4 +45,4 @@ May happen if version 2.0 ever materializes...
|
|||
* TCP socket to allow control via HTTP (web browser interface). Or maybe
|
||||
crontab-like CGI personality.
|
||||
|
||||
* GTK+/Bononbo/Gnome2 interface.
|
||||
* GTK+/d-bus/Gnome3 interface.
|
||||
|
|
|
|||
21
configure.ac
21
configure.ac
|
|
@ -2,7 +2,7 @@
|
|||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
|
||||
# Copyright (C) 2003, 2005, 2012 Dale Mellor
|
||||
# Copyright (C) 2003, 2005, 2012, 2014 Dale Mellor
|
||||
#
|
||||
# This file is part of GNU mcron.
|
||||
#
|
||||
|
|
@ -42,11 +42,9 @@ AC_SUBST(CONFIG_DEBUG)
|
|||
|
||||
AC_PROG_AWK
|
||||
AC_PROG_EGREP
|
||||
AC_PROG_CC
|
||||
GUILE_PROGS
|
||||
GUILE_FLAGS
|
||||
GUILE_SITE_DIR
|
||||
AM_PROG_CC_C_O
|
||||
|
||||
PKG_CHECK_MODULES(GUILE, guile-2.0 >= 2.0.7)
|
||||
|
||||
# Checks for programs.
|
||||
|
||||
|
|
@ -72,17 +70,6 @@ if test "x$ac_cv_prog_CP" = "x"; then
|
|||
fi
|
||||
|
||||
|
||||
# Check the Guile version.
|
||||
|
||||
AC_MSG_CHECKING(for guile version >= 1.8.0)
|
||||
if [$GUILE --version | $HEAD -1 | $AWK '{print $2}' | \
|
||||
$EGREP -q '^1\.8\.']; then
|
||||
AC_MSG_RESULT(OK)
|
||||
else
|
||||
AC_MSG_ERROR([Sorry, Guile 1.8.0 or greater is needed to run mcron])
|
||||
fi
|
||||
|
||||
|
||||
# Now find a sendmail or equivalent.
|
||||
|
||||
AC_CHECK_PROGS(SENDMAIL, sendmail)
|
||||
|
|
@ -182,5 +169,5 @@ real_program_prefix=`echo $program_prefix | sed s/NONE//`
|
|||
AC_SUBST(real_program_prefix)
|
||||
|
||||
|
||||
AC_CONFIG_FILES(makefile config.scm mcron.texinfo)
|
||||
AC_CONFIG_FILES(mcron.texinfo makefile config.scm)
|
||||
AC_OUTPUT
|
||||
|
|
|
|||
78
crontab.scm
78
crontab.scm
|
|
@ -1,4 +1,4 @@
|
|||
;; Copyright (C) 2003 Dale Mellor
|
||||
;; Copyright (C) 2003, 2014 Dale Mellor
|
||||
;;
|
||||
;; This file is part of GNU mcron.
|
||||
;;
|
||||
|
|
@ -27,14 +27,15 @@
|
|||
;; Procedure to communicate with running cron daemon that a user has modified
|
||||
;; his crontab. The user name is written to the /var/cron/socket UNIX socket.
|
||||
|
||||
(define (hit-server user-name)
|
||||
(let ((hit-server
|
||||
(lambda (user-name)
|
||||
(catch #t (lambda ()
|
||||
(let ((socket (socket AF_UNIX SOCK_STREAM 0)))
|
||||
(connect socket AF_UNIX config-socket-file)
|
||||
(display user-name socket)
|
||||
(close socket)))
|
||||
(lambda (key . args)
|
||||
(display "Warning: a cron daemon is not running.\n"))))
|
||||
(display "Warning: a cron daemon is not running.\n")))))
|
||||
|
||||
|
||||
|
||||
|
|
@ -42,38 +43,42 @@
|
|||
;; /var/cron/allow and /var/cron/deny), and determine if the given name is in
|
||||
;; there. The procedure returns #t, #f, or '() if the file does not exist.
|
||||
|
||||
(define (in-access-file? file name)
|
||||
(in-access-file?
|
||||
(lambda (file name)
|
||||
(catch #t (lambda ()
|
||||
(with-input-from-file file (lambda ()
|
||||
(with-input-from-file
|
||||
file
|
||||
(lambda ()
|
||||
(let loop ((input (read-line)))
|
||||
(if (eof-object? input)
|
||||
#f
|
||||
(if (string=? input name)
|
||||
#t
|
||||
(loop (read-line))))))))
|
||||
(lambda (key . args) '())))
|
||||
(lambda (key . args) '()))))
|
||||
|
||||
|
||||
|
||||
;; This program should have been installed SUID root. Here we get the passwd
|
||||
;; entry for the real user who is running this program.
|
||||
;; This program should have been installed SUID root. Here we get the
|
||||
;; passwd entry for the real user who is running this program.
|
||||
|
||||
(define crontab-real-user (passwd:name (getpw (getuid))))
|
||||
(crontab-real-user (passwd:name (getpw (getuid)))))
|
||||
|
||||
|
||||
|
||||
;; 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 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? config-allow-file crontab-real-user) #f)
|
||||
(if (or (eq? (in-access-file? config-allow-file crontab-real-user) #f)
|
||||
(eq? (in-access-file? config-deny-file crontab-real-user) #t))
|
||||
(mcron-error 6 "Access denied by system operator."))
|
||||
|
||||
|
||||
|
||||
;; Check that no more than one of the mutually exclusive options are being used.
|
||||
;; Check that no more than one of the mutually exclusive options are being
|
||||
;; used.
|
||||
|
||||
(if (> (+ (if (option-ref options 'edit #f) 1 0)
|
||||
(if (> (+ (if (option-ref options 'edit #f) 1 0)
|
||||
(if (option-ref options 'list #f) 1 0)
|
||||
(if (option-ref options 'remove #f) 1 0))
|
||||
1)
|
||||
|
|
@ -81,32 +86,34 @@
|
|||
|
||||
|
||||
|
||||
;; Check that a non-root user is trying to read someone else's files.
|
||||
;; Check that a non-root user is trying to read someone else's files.
|
||||
|
||||
(if (and (not (eqv? (getuid) 0))
|
||||
(if (and (not (eqv? (getuid) 0))
|
||||
(option-ref options 'user #f))
|
||||
(mcron-error 8 "Only root can use the -u option."))
|
||||
|
||||
|
||||
|
||||
;; Iff the --user option is given, the crontab-user may be different from the
|
||||
;; real user.
|
||||
(let (
|
||||
|
||||
(define crontab-user (option-ref options 'user crontab-real-user))
|
||||
|
||||
;; Iff the --user option is given, the crontab-user may be different
|
||||
;; from the real user.
|
||||
|
||||
(crontab-user (option-ref options 'user crontab-real-user))
|
||||
|
||||
|
||||
;; So now we know which crontab file we will be manipulating.
|
||||
|
||||
(crontab-file (string-append config-spool-dir "/" crontab-user))
|
||||
|
||||
|
||||
|
||||
;; So now we know which crontab file we will be manipulating.
|
||||
;; Display the prompt and wait for user to type his choice. Return #t if
|
||||
;; the answer begins with 'y' or 'Y', return #f if it begins with 'n' or
|
||||
;; 'N', otherwise ask again.
|
||||
|
||||
(define crontab-file (string-append config-spool-dir "/" crontab-user))
|
||||
|
||||
|
||||
|
||||
;; Display the prompt and wait for user to type his choice. Return #t if the
|
||||
;; answer begins with 'y' or 'Y', return #f if it begins with 'n' or 'N',
|
||||
;; otherwise ask again.
|
||||
|
||||
(define (get-yes-no prompt . re-prompt)
|
||||
(get-yes-no (lambda (prompt . re-prompt)
|
||||
(if (not (null? re-prompt))
|
||||
(display "Please answer y or n.\n"))
|
||||
(display (string-append prompt " "))
|
||||
|
|
@ -116,15 +123,15 @@
|
|||
((#\y #\Y) #t)
|
||||
((#\n #\N) #f)
|
||||
(else (get-yes-no prompt #t)))
|
||||
(get-yes-no prompt #t))))
|
||||
(get-yes-no prompt #t))))))
|
||||
|
||||
|
||||
|
||||
;; There are four possible sub-personalities to the crontab personality: list,
|
||||
;; remove, edit and replace (when the user uses no options but supplies file
|
||||
;; names on the command line).
|
||||
;; There are four possible sub-personalities to the crontab personality:
|
||||
;; list, remove, edit and replace (when the user uses no options but
|
||||
;; supplies file names on the command line).
|
||||
|
||||
(cond
|
||||
(cond
|
||||
|
||||
|
||||
;; In the list personality, we simply open the crontab and copy it
|
||||
|
|
@ -216,3 +223,6 @@
|
|||
|
||||
(else
|
||||
(mcron-error 15 "usage error: file name must be specified for replace.")))
|
||||
|
||||
|
||||
)) ;; End of file-level let-scopes.
|
||||
|
|
|
|||
2
main.scm
2
main.scm
|
|
@ -131,7 +131,7 @@
|
|||
" command-name " (" config-package-string ")\n
|
||||
Written by Dale Mellor\n
|
||||
\n
|
||||
Copyright (C) 2003, 2006 Dale Mellor\n
|
||||
Copyright (C) 2003, 2006, 2014 Dale Mellor\n
|
||||
This is free software; see the source for copying conditions. There is NO\n
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n
|
||||
"))
|
||||
|
|
|
|||
|
|
@ -31,15 +31,14 @@ EXTRA_DIST = makefile.ed main.scm mcron-core.scm vixie-specification.scm \
|
|||
crontab.scm environment.scm job-specifier.scm redirect.scm \
|
||||
vixie-time.scm mcron.c.template BUGS
|
||||
|
||||
AM_LDFLAGS = @GUILE_LDFLAGS@
|
||||
AM_CFLAGS = @GUILE_CFLAGS@ -DGUILE_LOAD_PATH=\"$(datadir)\"
|
||||
|
||||
info_TEXINFOS = mcron.texinfo
|
||||
|
||||
dist_man1_MANS = mcron.1
|
||||
|
||||
bin_PROGRAMS = mcron
|
||||
mcron_SOURCES = mcron.c
|
||||
mcron_LDADD = @GUILE_LIBS@
|
||||
mcron_CFLAGS = @GUILE_CFLAGS@ -DGUILE_LOAD_PATH=\"$(datadir)\"
|
||||
|
||||
pkgdata_DATA = core.scm environment.scm job-specifier.scm redirect.scm \
|
||||
vixie-time.scm vixie-specification.scm config.scm
|
||||
|
|
@ -49,9 +48,6 @@ 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
|
||||
|
||||
|
|
|
|||
50
mcron.1
50
mcron.1
|
|
@ -1,50 +0,0 @@
|
|||
.\" 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
|
||||
.B mcron
|
||||
[\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 ~/.config/cron (or the
|
||||
deprecated ~/.cron) with .guile or .vixie extensions.
|
||||
.TP
|
||||
\fB\-v\fR, \fB\-\-version\fR
|
||||
Display version
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
Display this help message
|
||||
.TP
|
||||
\fB\-sN\fR, \fB\-\-schedule[\fR=\fI]N\fR
|
||||
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
|
||||
.TP
|
||||
\fB\-i\fR, \fB\-\-stdin=\fR(guile|vixie) Format of data passed as standard input or
|
||||
file arguments (default guile)
|
||||
.SH AUTHOR
|
||||
Written by Dale Mellor
|
||||
.SH "REPORTING BUGS"
|
||||
Report bugs to dale_mellor@users.sourceforge.net.
|
||||
.PP
|
||||
mcron (mcron 1.0.7)
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2003, 2006 Dale Mellor
|
||||
.br
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.SH "SEE ALSO"
|
||||
The full documentation for
|
||||
.B mcron
|
||||
is maintained as a Texinfo manual. If the
|
||||
.B info
|
||||
and
|
||||
.B mcron
|
||||
programs are properly installed at your site, the command
|
||||
.IP
|
||||
.B info mcron
|
||||
.PP
|
||||
should give you access to the complete manual.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/* -*-c-*- */
|
||||
/*
|
||||
* Copyright (C) 2003 Dale Mellor
|
||||
* Copyright (C) 2003, 2014 Dale Mellor
|
||||
*
|
||||
* This file is part of GNU mcron.
|
||||
*
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
void
|
||||
react_to_terminal_signal (int sig)
|
||||
{
|
||||
scm_eval_string (scm_take0str ("(delete-run-file)") );
|
||||
scm_c_eval_string ("(delete-run-file)");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
|
@ -100,9 +100,9 @@ inner_main ()
|
|||
{
|
||||
scm_c_define_gsubr ("c-set-cron-signals", 0, 0, 0, set_cron_signals);
|
||||
|
||||
scm_eval_string (scm_take0str (
|
||||
scm_c_eval_string (
|
||||
GUILE_PROGRAM_GOES_HERE
|
||||
) );
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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, 2012 Dale Mellor
|
||||
Copyright @copyright{} 2003, 2005, 2006, 2012, 2014 Dale Mellor
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue