crontab2english -- explain crontab commands in English
Usage:
% crontab2english [-f] files...
Or:
% cat files... | crontab2english
If you do just this:
% crontab2english
then it's the same as crontab -l | crontab2english
Example output:
% crontab2english | less
Setting env var MAILTO to hulahoops@polygon.int
Command: (line 2)
Run: /bin/csh -c 'perl ~/thang.pl | mail -s hujambo root'
At: 8:10am on the 15th of every month
Command: (line 5)
Run: df -k
At: 5:40am every day
Command: (line 7)
Run: ls -l /tmp
At: 6:50am every Monday
Or with the -f ("f" for filter) switch, it just adds comments
to the input file:
% crontab2english -f | less
# My happy crontab file
MAILTO=hulahoops@polygon.int
10 8 15 * * /bin/csh -c 'perl ~/thang.pl | mail -s hujambo root'
#> At: 8:10am on the 15th of every month
40 5 * * * df -k
#> At: 5:40am every day
50 6 * * 1 ls -l /tmp
#> At: 6:50am every Monday
It's easy to make mistakes in crontab files. Running crontab2english on your crontab files and reading the resulting English explanations will help you catch errors.
-f puts this in "filter mode" -- the output is just the input plus commentary.
-v describes the current crontab2english version to STDOUT and exits.
-p forces POSIX-only mode: anything not allowed in the POSIX crontab spec won't be understood.
-e (usually default) turns off POSIX-only mode: i.e., it doesn't feign ignorance of things not in the POSIX spec.
-- signals end of switches.
If the evironment variables POSIXLY_CORRECT and/or POSIX_ME_HARDER are true, then this turns on -p (POSIX-only) mode by default. That's overrideable with the -e switch.
I've tried to make this program understand all the kinds of crontab lines that are out there. That probably includes a few kinds of lines that your particular cron daemon doesn't understand, so just because crontab2english understands something doesn't mean your cron daemon will.
Pragmatically, however, there seem to be three kinds of cron daemons around these days:
There could be some ancient or demented pre-Vixie non-POSIX crons running somewhere. One hopes that these would all basically understand anything that POSIX does (and possibly nothing more?), but you just might find peculiarities including:
Consult your man pages carefully.
Good general advice: keep your crontab lines simple, and that'll minimize the chances of disagreement between what you indend, what crontab2english understands (with or without -p), and what your cron daemon understands.
man 1 crontab
man 5 crontab
man 8 cron
If this program explains a crontab line wrong, or can't parse it, then email me the line, and an explanation of how it you think it should parse.
crontab2english 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.
Copyright 2001 Sean M. Burke.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Sean M. Burke, <sburke@cpan.org>
Translates crontab notation into English, for sanity checking: For example, "10 8 15 * * foo bar" into: Run: foo bar with input "baz\x0a" At: 8:10am on the 15th of every month
UNIX/System_administration
@annually".-p, -e, and the evironment variables POSIXLY_CORRECT and/or POSIX_ME_HARDER.