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> | 2010-06-13  Dale Mellor <dale_mellor@users.sourceforge.net> | ||||||
| 
 | 
 | ||||||
| 	* configure.ac: added --enable-no-vixie-clobber argument to | 	* 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. | 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 | Sunday, 20th June 2010 | ||||||
| 
 | 
 | ||||||
|     Standardized the copyright notices on all auxiliary files (including this |     Standardized the copyright notices on all auxiliary files (including this | ||||||
|  |  | ||||||
							
								
								
									
										4
									
								
								README
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								README
									
										
									
									
									
								
							|  | @ -1,13 +1,13 @@ | ||||||
| GNU mcron --- README                                  -*-text-*- | 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, |   Copying and distribution of this file, with or without modification, | ||||||
|   are permitted in any medium without royalty provided the copyright |   are permitted in any medium without royalty provided the copyright | ||||||
|   notice and this notice are preserved. |   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 | Dale Mellor, and replaces and hugely enhances Vixie cron. It is functionally | ||||||
| complete, production quality code (did you expect less?), but has not received | 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 | 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. | # 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. | #    This file is part of GNU mcron. | ||||||
| #  | #  | ||||||
|  | @ -21,7 +21,7 @@ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| AC_PREREQ(2.61) | 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 | AM_INIT_AUTOMAKE | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										46
									
								
								main.scm
									
										
									
									
									
								
							
							
						
						
									
										46
									
								
								main.scm
									
										
									
									
									
								
							|  | @ -1,4 +1,4 @@ | ||||||
| ;;   Copyright (C) 2003 Dale Mellor | ;;   Copyright (C) 2003, 2012 Dale Mellor | ||||||
| ;;  | ;;  | ||||||
| ;;   This file is part of GNU mcron. | ;;   This file is part of GNU mcron. | ||||||
| ;; | ;; | ||||||
|  | @ -150,14 +150,14 @@ Usage: " (car (command-line)) | ||||||
|   ((mcron) |   ((mcron) | ||||||
| " [OPTIONS] [FILES]\n | " [OPTIONS] [FILES]\n | ||||||
| Run an mcron process according to the specifications in the FILES (`-' for\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 | standard input), or use all the files in ~/.config/cron (or the \n | ||||||
| extensions.\n | deprecated ~/.cron) with .guile or .vixie extensions.\n | ||||||
| \n | \n | ||||||
|   -v, --version             Display version\n |   -v, --version             Display version\n | ||||||
|   -h, --help                Display this help message\n |   -h, --help                Display this help message\n | ||||||
|   -sN, --schedule[=]N       Display the next N jobs that will be run by mcron\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 |   -d, --daemon              Immediately detach the program from the terminal\n | ||||||
|                               run as a daemon process\n |                               and run as a daemon process\n | ||||||
|   -i, --stdin=(guile|vixie) Format of data passed as standard input or\n |   -i, --stdin=(guile|vixie) Format of data passed as standard input or\n | ||||||
|                               file arguments (default guile)") |                               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 | ;; Procedure to run through all the files in a user's ~/.cron and/or | ||||||
| ;; happens under the mcron personality). | ;; $XDG_CONFIG_HOME/cron or ~/.config/cron directories (only happens under the | ||||||
|  | ;; mcron personality). | ||||||
| 
 | 
 | ||||||
| (define (process-files-in-user-directory) | (define (process-files-in-user-directory) | ||||||
|   (catch #t (lambda () |   (let ((errors 0) | ||||||
|               (let* ((dir-path (string-append (passwd:dir (getpw (getuid))) |         (home-directory (passwd:dir (getpw (getuid))))) | ||||||
|                                               "/.cron")) |     (map (lambda (config-directory) | ||||||
|                      (directory (opendir dir-path))) |           (catch #t | ||||||
|  |                  (lambda () | ||||||
|  |                    (let ((directory (opendir config-directory))) | ||||||
|                      (do ((file-name (readdir directory) (readdir directory))) |                      (do ((file-name (readdir directory) (readdir directory))) | ||||||
|                          ((eof-object? file-name) (closedir directory)) |                          ((eof-object? file-name) (closedir directory)) | ||||||
|                   (process-user-file (string-append dir-path |                        (process-user-file (string-append config-directory | ||||||
|                                                          "/" |                                                          "/" | ||||||
|                                                          file-name))))) |                                                          file-name))))) | ||||||
|                  (lambda (key . args) |                  (lambda (key . args) | ||||||
|            (mcron-error 13 "Cannot read files in your ~/.cron directory.")))) |                    (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 | ;; Having defined all the necessary procedures for scanning various sets of | ||||||
| ;; files, we perform the actual configuration of the program depending on the | ;; 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 | ;; 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 | ;; passed on the command line, or else all the ones in the user's .config/cron | ||||||
| ;; directory. If we are running under the cron personality, we read the | ;; (or .cron) directory. If we are running under the cron personality, we read | ||||||
| ;; /var/cron/tabs directory and also the /etc/crontab file. | ;; the /var/cron/tabs directory and also the /etc/crontab file. | ||||||
| 
 | 
 | ||||||
| (case command-type | (case command-type | ||||||
|   ((mcron) (if (null? (option-ref options '() '())) |   ((mcron) (if (null? (option-ref options '() '())) | ||||||
|  | @ -380,7 +390,7 @@ Report bugs to " config-package-bugreport ".\n | ||||||
|    (if (not (option-ref options 'noetc #f)) |    (if (not (option-ref options 'noetc #f)) | ||||||
|        (begin |        (begin | ||||||
|          (display |          (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 | 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 | make a change, then it is HIGHLY RECOMMENDED that you use the --noetc\n | ||||||
| option.\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 | # like core.*, so we have to keep re-making it (I lost a good day's work because | ||||||
| # of this). | # of this). | ||||||
| 
 | 
 | ||||||
|  | mcron : mcron.c | ||||||
|  | 	$(CC) $(AM_CFLAGS) mcron.c -o mcron $(AM_LDFLAGS) | ||||||
|  | 
 | ||||||
| core.scm : mcron-core.scm | core.scm : mcron-core.scm | ||||||
| 	$(CP) mcron-core.scm 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. | .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.40.4. | ||||||
| .TH MCRON "1" "June 2010" "mcron " "User Commands" | .TH MCRON "1" "February 2012" "mcron " "User Commands" | ||||||
| .SH NAME | .SH NAME | ||||||
| mcron \- a program to run tasks at regular (or not) intervals | mcron \- a program to run tasks at regular (or not) intervals | ||||||
| .SH SYNOPSIS | .SH SYNOPSIS | ||||||
|  | @ -7,8 +7,8 @@ mcron \- a program to run tasks at regular (or not) intervals | ||||||
| [\fIOPTIONS\fR] [\fIFILES\fR] | [\fIOPTIONS\fR] [\fIFILES\fR] | ||||||
| .SH DESCRIPTION | .SH DESCRIPTION | ||||||
| Run an mcron process according to the specifications in the FILES (`\-' for | 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 | standard input), or use all the files in ~/.config/cron (or the | ||||||
| extensions. | deprecated ~/.cron) with .guile or .vixie extensions. | ||||||
| .TP | .TP | ||||||
| \fB\-v\fR, \fB\-\-version\fR | \fB\-v\fR, \fB\-\-version\fR | ||||||
| Display version | Display version | ||||||
|  | @ -20,8 +20,8 @@ Display this help message | ||||||
| Display the next N jobs that will be run by mcron | Display the next N jobs that will be run by mcron | ||||||
| .TP | .TP | ||||||
| \fB\-d\fR, \fB\-\-daemon\fR | \fB\-d\fR, \fB\-\-daemon\fR | ||||||
| Immediately detach the program from the terminal and | Immediately detach the program from the terminal | ||||||
| run as a daemon process | and run as a daemon process | ||||||
| .TP | .TP | ||||||
| \fB\-i\fR, \fB\-\-stdin=\fR(guile|vixie) Format of data passed as standard input or | \fB\-i\fR, \fB\-\-stdin=\fR(guile|vixie) Format of data passed as standard input or | ||||||
| file arguments (default guile) | file arguments (default guile) | ||||||
|  | @ -30,7 +30,7 @@ Written by Dale Mellor | ||||||
| .SH "REPORTING BUGS" | .SH "REPORTING BUGS" | ||||||
| Report bugs to dale_mellor@users.sourceforge.net. | Report bugs to dale_mellor@users.sourceforge.net. | ||||||
| .PP | .PP | ||||||
| mcron  (mcron 1.0.6) | mcron  (mcron 1.0.7) | ||||||
| .SH COPYRIGHT | .SH COPYRIGHT | ||||||
| Copyright \(co 2003, 2006  Dale Mellor | Copyright \(co 2003, 2006  Dale Mellor | ||||||
| .br | .br | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ | ||||||
| @copying This manual is for GNU mcron (version @VERSION@), which is a | @copying This manual is for GNU mcron (version @VERSION@), which is a | ||||||
| program for running jobs at scheduled times. | program for running jobs at scheduled times. | ||||||
| 
 | 
 | ||||||
| Copyright @copyright{} 2003, 2005, 2006 Dale Mellor | Copyright @copyright{}  2003, 2005, 2006, 2012  Dale Mellor | ||||||
| 
 | 
 | ||||||
| @quotation | @quotation | ||||||
| Permission is granted to copy, distribute and/or modify this | 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 examples, guile | ||||||
| @cindex example, run a program every hour | @cindex example, run a program every hour | ||||||
| You have an executable @code{my-program} in your home directory, which | 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 | you want to run every hour.  Create a file @code{job.guile} in | ||||||
| @code{~/.cron} with the following contents | directory @code{~/.config/cron} (this path may be altered by the | ||||||
|  | @code{$XDG_CONFIG_HOME} environment variable) with the following | ||||||
|  | contents | ||||||
| 
 | 
 | ||||||
| @example | @example | ||||||
| (job '(next-hour) "my-program") | (job '(next-hour) "my-program") | ||||||
|  | @ -224,7 +226,7 @@ also the next section) | ||||||
| and run the @code{mcron} command. | and run the @code{mcron} command. | ||||||
| 
 | 
 | ||||||
| If you want to run other jobs, you can either add more lines to this | 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 | 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 | you want and pass it as an argument to @code{mcron}, or even pipe the | ||||||
| commands into the standard input. | commands into the standard input. | ||||||
|  | @ -808,26 +810,28 @@ place in the part which implements the mcron personality. | ||||||
| @cindex mcron arguments | @cindex mcron arguments | ||||||
| @cindex command line, mcron | @cindex command line, mcron | ||||||
| @cindex mcron command line | @cindex mcron command line | ||||||
| Mcron should be run by the user who wants to schedule his jobs.  It may | Mcron should be run by the user who wants to schedule his jobs.  It | ||||||
| be made a background job using the facilities of the shell.  The basic | may be made a background job using the facilities of the shell.  The | ||||||
| command is | basic command is @code{mcron [OPTION ...] [file ...]}  which has the | ||||||
| @code{mcron [OPTION ...] [file ...]} | effect of reading all the configuration files specified (subject to | ||||||
| which has the effect of reading all the configuration files specified | the options) and then waiting until it is time to execute some | ||||||
| (subject to the options) and then waiting until it is time to execute | command.  If no files are given on the command line, then mcron will | ||||||
| some command.  If no files are given on the command line, then mcron | look in the user's cron configuration directories: these are ~/.cron | ||||||
| will look in the user's ~/.cron directory.  In either case, files which | (deprecated), the directory indicated by the @code{XDG_CONFIG_HOME} | ||||||
| end in the extension .vixie or .vix will be assumed to contain | environment variable, or ~/.config/cron if this variable is not set. | ||||||
| Vixie-style crontabs, and files ending .guile or .gle will be assumed | In any case, files which end in the extension .vixie or .vix will be | ||||||
| to contain scheme code and will be executed as such; ANY OTHER FILES | assumed to contain Vixie-style crontabs, and files ending .guile or | ||||||
| WILL BE IGNORED - specify a file name of ``-'' and then pipe the files | .gle will be assumed to contain scheme code and will be executed as | ||||||
| into the standard input if you really want to read them, possibly | such; ANY OTHER FILES WILL BE IGNORED - specify a file name of ``-'' | ||||||
| using the @code{stdin} option to specify the type of file. | 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. | The program accepts the following options. | ||||||
| 
 | 
 | ||||||
| @table @option | @table @option | ||||||
| @item -s [count] | @item -s count | ||||||
| @itemx --schedule[=count] | @itemx --schedule=count | ||||||
| @cindex printout of jobs schedule | @cindex printout of jobs schedule | ||||||
| @cindex schedule of jobs, listing | @cindex schedule of jobs, listing | ||||||
| @cindex options, schedule | @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 | computes the times the commands would be run and prints the | ||||||
| information to the screen, and then immediately exits. | information to the screen, and then immediately exits. | ||||||
| 
 | 
 | ||||||
| The count, if supplied, indicates the number of commands to | The count indicates the number of commands to display. | ||||||
| display.  The default value is 8. |  | ||||||
| 
 | 
 | ||||||
| @cindex daemon option | @cindex daemon option | ||||||
| @cindex options, daemon | @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}. | @code{mcron}, @code{cron}, @code{crond} or @code{crontab}. | ||||||
| 
 | 
 | ||||||
| @item 13 | @item 13 | ||||||
| Either the ~/.cron directory does not exist, or there is a problem | Either none of the user's configuration directories exist, or there is a problem | ||||||
| reading the files there. | 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 @item 14 | ||||||
| @c There is a problem writing to /var/cron/update.  This is probably | @c There is a problem writing to /var/cron/update.  This is probably | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dale Mellor
				Dale Mellor