184f33deaSJordan K. Hubbard 284f33deaSJordan K. HubbardConversion of BSD 4.[23] crontab files: 384f33deaSJordan K. Hubbard 484f33deaSJordan K. HubbardEdit your current crontab (/usr/lib/crontab) into little pieces, with each 584f33deaSJordan K. Hubbardusers' commands in a different file. This is different on 4.2 and 4.3, 684f33deaSJordan K. Hubbardbut I'll get to that below. The biggest feature of this cron is that you 784f33deaSJordan K. Hubbardcan move 'news' and 'uucp' cron commands into files owned and maintainable 884f33deaSJordan K. Hubbardby those two users. You also get to rip all the fancy 'su' footwork out 984f33deaSJordan K. Hubbardof the cron commands. On 4.3, there's no need for the 'su' stuff since the 1084f33deaSJordan K. Hubbarduser name appears on each command -- but I'd still rather have separate 111a6e52d0SJeroen Ruigrok van der Wervencrontabs with separate environments and so on. 1284f33deaSJordan K. Hubbard 1384f33deaSJordan K. HubbardLeave the original /usr/lib/crontab! This cron doesn't use it, so you may 1484f33deaSJordan K. Hubbardas well keep it around for a while in case something goes wakko with this 1584f33deaSJordan K. Hubbardfancy version. 1684f33deaSJordan K. Hubbard 1784f33deaSJordan K. HubbardMost commands in most crontabs are run by root, have to run by root, and 1884f33deaSJordan K. Hubbardshould continue to be run by root. They still have to be in their own file; 1984f33deaSJordan K. HubbardI recommend /etc/crontab.src or /usr/adm/crontab.src. 2084f33deaSJordan K. Hubbard 2184f33deaSJordan K. Hubbard'uucp's commands need their own file; how about /usr/lib/uucp/crontab.src? 2284f33deaSJordan K. Hubbard'news' also, perhaps in /usr/lib/news/crontab.src... 2384f33deaSJordan K. Hubbard 2484f33deaSJordan K. HubbardI say `how about' and `perhaps' because it really doesn't matter to anyone 2584f33deaSJordan K. Hubbard(except you) where you put the crontab source files. The `crontab' command 2684f33deaSJordan K. HubbardCOPIES them into a protected directory (CRONDIR/SPOOL_DIR in cron.h), named 2784f33deaSJordan K. Hubbardafter the user whose crontab it is. If you want to examine, replace, or 2884f33deaSJordan K. Hubbarddelete a crontab, the `crontab' command does all of those things. The 2984f33deaSJordan K. Hubbardvarious `crontab.src' (my suggested name for them) files are just source 3084f33deaSJordan K. Hubbardfiles---they have to be copied to SPOOLDIR using `crontab' before they'll be 3184f33deaSJordan K. Hubbardexecuted. 3284f33deaSJordan K. Hubbard 3384f33deaSJordan K. HubbardOn 4.2, your crontab might have a few lines like this: 3484f33deaSJordan K. Hubbard 3584f33deaSJordan K. Hubbard 5 * * * * su uucp < /usr/lib/uucp/uudemon.hr 3684f33deaSJordan K. Hubbard 10 4 * * * su uucp < /usr/lib/uucp/uudemon.day 3784f33deaSJordan K. Hubbard 15 5 * * 0 su uucp < /usr/lib/uucp/uudemon.wk 3884f33deaSJordan K. Hubbard 3984f33deaSJordan K. Hubbard...or like this: 4084f33deaSJordan K. Hubbard 4184f33deaSJordan K. Hubbard 5 * * * * echo /usr/lib/uucp/uudemon.hr | su uucp 4284f33deaSJordan K. Hubbard 10 4 * * * echo /usr/lib/uucp/uudemon.day | su uucp 4384f33deaSJordan K. Hubbard 15 5 * * 0 echo /usr/lib/uucp/uudemon.wk | su uucp 4484f33deaSJordan K. Hubbard 4584f33deaSJordan K. HubbardOn 4.3, they'd look a little bit better, but not much: 4684f33deaSJordan K. Hubbard 4784f33deaSJordan K. Hubbard 5 * * * * uucp /usr/lib/uucp/uudemon.hr 4884f33deaSJordan K. Hubbard 10 4 * * * uucp /usr/lib/uucp/uudemon.day 4984f33deaSJordan K. Hubbard 15 5 * * 0 uucp /usr/lib/uucp/uudemon.wk 5084f33deaSJordan K. Hubbard 5184f33deaSJordan K. HubbardFor this cron, you'd create /usr/lib/uucp/crontab.src (or wherever you want 5284f33deaSJordan K. Hubbardto keep uucp's commands) which would look like this: 5384f33deaSJordan K. Hubbard 5484f33deaSJordan K. Hubbard # /usr/lib/uucp/crontab.src - uucp's crontab 5584f33deaSJordan K. Hubbard # 5684f33deaSJordan K. Hubbard PATH=/usr/lib/uucp:/bin:/usr/bin 5784f33deaSJordan K. Hubbard SHELL=/bin/sh 5884f33deaSJordan K. Hubbard HOME=/usr/lib/uucp 5984f33deaSJordan K. Hubbard # 6084f33deaSJordan K. Hubbard 5 * * * * uudemon.hr 6184f33deaSJordan K. Hubbard 10 4 * * * uudemon.day 6284f33deaSJordan K. Hubbard 15 5 * * 0 uudemon.wk 6384f33deaSJordan K. Hubbard 6484f33deaSJordan K. HubbardThe application to the `news' cron commands (if any) is left for you to 6584f33deaSJordan K. Hubbardfigure out. Likewise if there are any other cruddy-looking 'su' commands in 6684f33deaSJordan K. Hubbardyour crontab commands, you don't need them anymore: just find a good place 6784f33deaSJordan K. Hubbardto put the `crontab.src' (or whatever you want to call it) file for that 6884f33deaSJordan K. Hubbarduser, put the cron commands into it, and install it using the `crontab' 6984f33deaSJordan K. Hubbardcommand (probably with "-u USERNAME", but see the man page). 7084f33deaSJordan K. Hubbard 7184f33deaSJordan K. HubbardIf you run a 4.2-derived cron, you could of course just install your current 7284f33deaSJordan K. Hubbardcrontab in toto as root's crontab. It would work exactly the way your 7384f33deaSJordan K. Hubbardcurrent one does, barring the extra steps in installing or changing it. 7484f33deaSJordan K. HubbardThere would still be advantages to this cron, mostly that you get mail if 7584f33deaSJordan K. Hubbardthere is any output from your cron commands. 7684f33deaSJordan K. Hubbard 7784f33deaSJordan K. HubbardOne note about getting mail from cron: you will probably find, after you 7884f33deaSJordan K. Hubbardinstall this version of cron, that your cron commands are generating a lot 7984f33deaSJordan K. Hubbardof irritating output. The work-around for this is to redirect all EXPECTED 8084f33deaSJordan K. Hubbardoutput to a per-execution log file, which you can examine if you want to 8184f33deaSJordan K. Hubbardsee the output from the "last time" a command was executed; if you get any 8284f33deaSJordan K. HubbardUNEXPECTED output, it will be mailed to you. This takes a while to get 8384f33deaSJordan K. Hubbardright, but it's amazingly convenient. Trust me. 8484f33deaSJordan K. Hubbard 85