1 2Features of Vixie's cron relative to BSD 4.[23] and SysV crons: 3 4-- Environment variables can be set in each crontab. SHELL, USER, 5 LOGNAME, and HOME are set from the user's passwd entry; all except 6 USER can be changed in the crontab. PATH is especially useful to 7 set there. TZ can be set, but cron ignores it other than passing 8 it on through to the commands it runs. Format is 9 10 variable=value 11 12 Blanks surrounding the '=' will be eaten; other blanks in value are 13 okay. Leading or trailing blanks can be preserved by quoting, single 14 or double quotes are okay, just so they match. 15 16 PATH=.:/bin:/usr/bin 17 SHELL=/bin/sh 18 FOOBAR = this is a long blanky example 19 20 Above, FOOBAR would get "this is a long blanky example" as its value. 21 22 SHELL and HOME will be used when it's time to run a command; if 23 you don't set them, HOME defaults to your /etc/passwd entry 24 and SHELL defaults to /bin/sh. 25 26 MAILTO, if set to the login name of a user on your system, will be the 27 person that cron mails the output of commands in that crontab. This is 28 useful if you decide on BINMAIL when configuring cron.h, since binmail 29 doesn't know anything about aliasing. 30 31-- Weekdays can be specified by name. Case is not significant, but only 32 the first three letters should be specified. 33 34-- Months can likewise be specified by name. Three letters only. 35 36-- Ranges and lists can be mixed. Standard crons won't allow '1,3-5'. 37 38-- Ranges can specify 'step' values. '10-16/2' is like '10,12,14,16'. 39 40-- Sunday is both day 0 and day 7 -- apparently BSD and ATT disagree 41 about this. 42 43-- Each user gets their own crontab file. This is a win over BSD 4.2, 44 where only root has one, and over BSD 4.3, where they made the crontab 45 format incompatible and although the commands can be run by non-root 46 uid's, root is still the only one who can edit the crontab file. This 47 feature mimics the SysV cron. 48 49-- The 'crontab' command is loosely compatible with SysV, but has more 50 options which just generally make more sense. Running crontab with 51 no arguments will print a cute little summary of the command syntax. 52 53-- Comments and blank lines are allowed in the crontab file. Comments 54 must be on a line by themselves; leading whitespace is ignored, and 55 a '#' introduces the comment. 56 57-- (big win) If the `crontab' command changes anything in any crontab, 58 the 'cron' daemon will reload all the tables before running the 59 next iteration. In some crons, you have to kill and restart the 60 daemon whenever you change a crontab. In other crons, the crontab 61 file is reread and reparsed every minute even if it didn't change. 62 63-- In order to support the automatic reload, the crontab files are not 64 readable or writable except by 'crontab' or 'cron'. This is not a 65 problem, since 'crontab' will let you do pretty much whatever you 66 want to your own crontab, or if you are root, to anybody's crontab. 67 68-- If any output is generated by a command (on stdout OR stderr), it will 69 be mailed to the owner of the crontab that contained the command (or 70 MAILTO, see discussion of environment variables, above). The headers 71 of the mail message will include the command that was run, and a 72 complete list of the environment that was passed to it, which will 73 contain (at least) the USER (LOGNAME on SysV), HOME, and SHELL. 74 75-- the dom/dow situation is odd. '* * 1,15 * Sun' will run on the 76 first and fifteenth AND every Sunday; '* * * * Sun' will run *only* 77 on Sundays; '* * 1,15 * *' will run *only* the 1st and 15th. this 78 is why we keep 'e->dow_star' and 'e->dom_star'. I didn't think up 79 this behaviour; it's how cron has always worked but the documentation 80 hasn't been very clear. I have been told that some AT&T crons do not 81 act this way and do the more reasonable thing, which is (IMHO) to "or" 82 the various field-matches together. In that sense this cron may not 83 be completely similar to some AT&T crons. 84