184f33deaSJordan K. Hubbard 284f33deaSJordan K. HubbardFeatures of Vixie's cron relative to BSD 4.[23] and SysV crons: 384f33deaSJordan K. Hubbard 484f33deaSJordan K. Hubbard-- Environment variables can be set in each crontab. SHELL, USER, 584f33deaSJordan K. Hubbard LOGNAME, and HOME are set from the user's passwd entry; all except 684f33deaSJordan K. Hubbard USER can be changed in the crontab. PATH is especially useful to 784f33deaSJordan K. Hubbard set there. TZ can be set, but cron ignores it other than passing 884f33deaSJordan K. Hubbard it on through to the commands it runs. Format is 984f33deaSJordan K. Hubbard 1084f33deaSJordan K. Hubbard variable=value 1184f33deaSJordan K. Hubbard 1284f33deaSJordan K. Hubbard Blanks surrounding the '=' will be eaten; other blanks in value are 1384f33deaSJordan K. Hubbard okay. Leading or trailing blanks can be preserved by quoting, single 1484f33deaSJordan K. Hubbard or double quotes are okay, just so they match. 1584f33deaSJordan K. Hubbard 1684f33deaSJordan K. Hubbard PATH=.:/bin:/usr/bin 1784f33deaSJordan K. Hubbard SHELL=/bin/sh 1884f33deaSJordan K. Hubbard FOOBAR = this is a long blanky example 1984f33deaSJordan K. Hubbard 2084f33deaSJordan K. Hubbard Above, FOOBAR would get "this is a long blanky example" as its value. 2184f33deaSJordan K. Hubbard 2284f33deaSJordan K. Hubbard SHELL and HOME will be used when it's time to run a command; if 2384f33deaSJordan K. Hubbard you don't set them, HOME defaults to your /etc/passwd entry 2484f33deaSJordan K. Hubbard and SHELL defaults to /bin/sh. 2584f33deaSJordan K. Hubbard 2684f33deaSJordan K. Hubbard MAILTO, if set to the login name of a user on your system, will be the 2784f33deaSJordan K. Hubbard person that cron mails the output of commands in that crontab. This is 2884f33deaSJordan K. Hubbard useful if you decide on BINMAIL when configuring cron.h, since binmail 2984f33deaSJordan K. Hubbard doesn't know anything about aliasing. 3084f33deaSJordan K. Hubbard 3184f33deaSJordan K. Hubbard-- Weekdays can be specified by name. Case is not significant, but only 3284f33deaSJordan K. Hubbard the first three letters should be specified. 3384f33deaSJordan K. Hubbard 3484f33deaSJordan K. Hubbard-- Months can likewise be specified by name. Three letters only. 3584f33deaSJordan K. Hubbard 3684f33deaSJordan K. Hubbard-- Ranges and lists can be mixed. Standard crons won't allow '1,3-5'. 3784f33deaSJordan K. Hubbard 3884f33deaSJordan K. Hubbard-- Ranges can specify 'step' values. '10-16/2' is like '10,12,14,16'. 3984f33deaSJordan K. Hubbard 4084f33deaSJordan K. Hubbard-- Sunday is both day 0 and day 7 -- apparently BSD and ATT disagree 4184f33deaSJordan K. Hubbard about this. 4284f33deaSJordan K. Hubbard 4384f33deaSJordan K. Hubbard-- Each user gets their own crontab file. This is a win over BSD 4.2, 4484f33deaSJordan K. Hubbard where only root has one, and over BSD 4.3, where they made the crontab 4584f33deaSJordan K. Hubbard format incompatible and although the commands can be run by non-root 4684f33deaSJordan K. Hubbard uid's, root is still the only one who can edit the crontab file. This 4784f33deaSJordan K. Hubbard feature mimics the SysV cron. 4884f33deaSJordan K. Hubbard 4984f33deaSJordan K. Hubbard-- The 'crontab' command is loosely compatible with SysV, but has more 5084f33deaSJordan K. Hubbard options which just generally make more sense. Running crontab with 5184f33deaSJordan K. Hubbard no arguments will print a cute little summary of the command syntax. 5284f33deaSJordan K. Hubbard 5384f33deaSJordan K. Hubbard-- Comments and blank lines are allowed in the crontab file. Comments 5484f33deaSJordan K. Hubbard must be on a line by themselves; leading whitespace is ignored, and 5584f33deaSJordan K. Hubbard a '#' introduces the comment. 5684f33deaSJordan K. Hubbard 5784f33deaSJordan K. Hubbard-- (big win) If the `crontab' command changes anything in any crontab, 5884f33deaSJordan K. Hubbard the 'cron' daemon will reload all the tables before running the 5984f33deaSJordan K. Hubbard next iteration. In some crons, you have to kill and restart the 6084f33deaSJordan K. Hubbard daemon whenever you change a crontab. In other crons, the crontab 6184f33deaSJordan K. Hubbard file is reread and reparsed every minute even if it didn't change. 6284f33deaSJordan K. Hubbard 6384f33deaSJordan K. Hubbard-- In order to support the automatic reload, the crontab files are not 6484f33deaSJordan K. Hubbard readable or writable except by 'crontab' or 'cron'. This is not a 6584f33deaSJordan K. Hubbard problem, since 'crontab' will let you do pretty much whatever you 6684f33deaSJordan K. Hubbard want to your own crontab, or if you are root, to anybody's crontab. 6784f33deaSJordan K. Hubbard 6884f33deaSJordan K. Hubbard-- If any output is generated by a command (on stdout OR stderr), it will 6984f33deaSJordan K. Hubbard be mailed to the owner of the crontab that contained the command (or 7084f33deaSJordan K. Hubbard MAILTO, see discussion of environment variables, above). The headers 7184f33deaSJordan K. Hubbard of the mail message will include the command that was run, and a 7284f33deaSJordan K. Hubbard complete list of the environment that was passed to it, which will 7384f33deaSJordan K. Hubbard contain (at least) the USER (LOGNAME on SysV), HOME, and SHELL. 7484f33deaSJordan K. Hubbard 7584f33deaSJordan K. Hubbard-- the dom/dow situation is odd. '* * 1,15 * Sun' will run on the 7684f33deaSJordan K. Hubbard first and fifteenth AND every Sunday; '* * * * Sun' will run *only* 7784f33deaSJordan K. Hubbard on Sundays; '* * 1,15 * *' will run *only* the 1st and 15th. this 7884f33deaSJordan K. Hubbard is why we keep 'e->dow_star' and 'e->dom_star'. I didn't think up 7984f33deaSJordan K. Hubbard this behaviour; it's how cron has always worked but the documentation 8084f33deaSJordan K. Hubbard hasn't been very clear. I have been told that some AT&T crons do not 8184f33deaSJordan K. Hubbard act this way and do the more reasonable thing, which is (IMHO) to "or" 8284f33deaSJordan K. Hubbard the various field-matches together. In that sense this cron may not 8384f33deaSJordan K. Hubbard be completely similar to some AT&T crons. 84