150479Speter$FreeBSD$
22311Sjkh
32311SjkhFeatures of Vixie's cron relative to BSD 4.[23] and SysV crons:
42311Sjkh
52311Sjkh--	Environment variables can be set in each crontab.  SHELL, USER,
62311Sjkh	LOGNAME, and HOME are set from the user's passwd entry; all except
72311Sjkh	USER can be changed in the crontab.  PATH is especially useful to
82311Sjkh	set there.  TZ can be set, but cron ignores it other than passing
92311Sjkh	it on through to the commands it runs.  Format is
102311Sjkh
112311Sjkh		variable=value
122311Sjkh
132311Sjkh	Blanks surrounding the '=' will be eaten; other blanks in value are
142311Sjkh	okay.  Leading or trailing blanks can be preserved by quoting, single
152311Sjkh	or double quotes are okay, just so they match.
162311Sjkh
172311Sjkh		PATH=.:/bin:/usr/bin
182311Sjkh		SHELL=/bin/sh
192311Sjkh		FOOBAR = this is a long blanky example
202311Sjkh
212311Sjkh	Above, FOOBAR would get "this is a long blanky example" as its value.
222311Sjkh
232311Sjkh	SHELL and HOME will be used when it's time to run a command; if
242311Sjkh	you don't set them, HOME defaults to your /etc/passwd entry
252311Sjkh	and SHELL defaults to /bin/sh.
262311Sjkh
272311Sjkh	MAILTO, if set to the login name of a user on your system, will be the
282311Sjkh	person that cron mails the output of commands in that crontab.  This is
292311Sjkh	useful if you decide on BINMAIL when configuring cron.h, since binmail
302311Sjkh	doesn't know anything about aliasing.
312311Sjkh
322311Sjkh--	Weekdays can be specified by name.  Case is not significant, but only
332311Sjkh	the first three letters should be specified.
342311Sjkh
352311Sjkh--	Months can likewise be specified by name.  Three letters only.
362311Sjkh
372311Sjkh--	Ranges and lists can be mixed.  Standard crons won't allow '1,3-5'.
382311Sjkh
392311Sjkh--	Ranges can specify 'step' values.  '10-16/2' is like '10,12,14,16'.
402311Sjkh
412311Sjkh--	Sunday is both day 0 and day 7 -- apparently BSD and ATT disagree
422311Sjkh	about this.
432311Sjkh
442311Sjkh--	Each user gets their own crontab file.  This is a win over BSD 4.2,
452311Sjkh	where only root has one, and over BSD 4.3, where they made the crontab
462311Sjkh	format incompatible and although the commands can be run by non-root
472311Sjkh	uid's, root is still the only one who can edit the crontab file.  This
482311Sjkh	feature mimics the SysV cron.
492311Sjkh
502311Sjkh--	The 'crontab' command is loosely compatible with SysV, but has more
512311Sjkh	options which just generally make more sense.  Running crontab with
522311Sjkh	no arguments will print a cute little summary of the command syntax.
532311Sjkh
542311Sjkh--	Comments and blank lines are allowed in the crontab file.  Comments
552311Sjkh	must be on a line by themselves; leading whitespace is ignored, and
562311Sjkh	a '#' introduces the comment.
572311Sjkh
582311Sjkh--	(big win) If the `crontab' command changes anything in any crontab,
592311Sjkh	the 'cron' daemon will reload all the tables before running the
602311Sjkh	next iteration.  In some crons, you have to kill and restart the
612311Sjkh	daemon whenever you change a crontab.  In other crons, the crontab
622311Sjkh	file is reread and reparsed every minute even if it didn't change.
632311Sjkh
642311Sjkh--	In order to support the automatic reload, the crontab files are not
652311Sjkh	readable or writable except by 'crontab' or 'cron'.  This is not a
662311Sjkh	problem, since 'crontab' will let you do pretty much whatever you
672311Sjkh	want to your own crontab, or if you are root, to anybody's crontab.
682311Sjkh
692311Sjkh--	If any output is generated by a command (on stdout OR stderr), it will
702311Sjkh	be mailed to the owner of the crontab that contained the command (or
712311Sjkh	MAILTO, see discussion of environment variables, above).  The headers
722311Sjkh	of the mail message will include the command that was run, and a
732311Sjkh	complete list of the environment that was passed to it, which will
742311Sjkh	contain (at least) the USER (LOGNAME on SysV), HOME, and SHELL.
752311Sjkh
762311Sjkh--	the dom/dow situation is odd.  '* * 1,15 * Sun' will run on the
772311Sjkh	first and fifteenth AND every Sunday;  '* * * * Sun' will run *only*
782311Sjkh	on Sundays;  '* * 1,15 * *' will run *only* the 1st and 15th.  this
792311Sjkh	is why we keep 'e->dow_star' and 'e->dom_star'.  I didn't think up
802311Sjkh	this behaviour; it's how cron has always worked but the documentation
812311Sjkh	hasn't been very clear.  I have been told that some AT&T crons do not
822311Sjkh	act this way and do the more reasonable thing, which is (IMHO) to "or"
832311Sjkh	the various field-matches together.  In that sense this cron may not
842311Sjkh	be completely similar to some AT&T crons.
85