CONVERSION revision 2311
12311Sjkh$Id: CONVERSION,v 2.2 1993/12/28 08:34:43 vixie Exp $ 22311Sjkh 32311SjkhConversion of BSD 4.[23] crontab files: 42311Sjkh 52311SjkhEdit your current crontab (/usr/lib/crontab) into little pieces, with each 62311Sjkhusers' commands in a different file. This is different on 4.2 and 4.3, 72311Sjkhbut I'll get to that below. The biggest feature of this cron is that you 82311Sjkhcan move 'news' and 'uucp' cron commands into files owned and maintainable 92311Sjkhby those two users. You also get to rip all the fancy 'su' footwork out 102311Sjkhof the cron commands. On 4.3, there's no need for the 'su' stuff since the 112311Sjkhuser name appears on each command -- but I'd still rather have separate 122311Sjkhcrontabs with seperate environments and so on. 132311Sjkh 142311SjkhLeave the original /usr/lib/crontab! This cron doesn't use it, so you may 152311Sjkhas well keep it around for a while in case something goes wakko with this 162311Sjkhfancy version. 172311Sjkh 182311SjkhMost commands in most crontabs are run by root, have to run by root, and 192311Sjkhshould continue to be run by root. They still have to be in their own file; 202311SjkhI recommend /etc/crontab.src or /usr/adm/crontab.src. 212311Sjkh 222311Sjkh'uucp's commands need their own file; how about /usr/lib/uucp/crontab.src? 232311Sjkh'news' also, perhaps in /usr/lib/news/crontab.src... 242311Sjkh 252311SjkhI say `how about' and `perhaps' because it really doesn't matter to anyone 262311Sjkh(except you) where you put the crontab source files. The `crontab' command 272311SjkhCOPIES them into a protected directory (CRONDIR/SPOOL_DIR in cron.h), named 282311Sjkhafter the user whose crontab it is. If you want to examine, replace, or 292311Sjkhdelete a crontab, the `crontab' command does all of those things. The 302311Sjkhvarious `crontab.src' (my suggested name for them) files are just source 312311Sjkhfiles---they have to be copied to SPOOLDIR using `crontab' before they'll be 322311Sjkhexecuted. 332311Sjkh 342311SjkhOn 4.2, your crontab might have a few lines like this: 352311Sjkh 362311Sjkh 5 * * * * su uucp < /usr/lib/uucp/uudemon.hr 372311Sjkh 10 4 * * * su uucp < /usr/lib/uucp/uudemon.day 382311Sjkh 15 5 * * 0 su uucp < /usr/lib/uucp/uudemon.wk 392311Sjkh 402311Sjkh...or like this: 412311Sjkh 422311Sjkh 5 * * * * echo /usr/lib/uucp/uudemon.hr | su uucp 432311Sjkh 10 4 * * * echo /usr/lib/uucp/uudemon.day | su uucp 442311Sjkh 15 5 * * 0 echo /usr/lib/uucp/uudemon.wk | su uucp 452311Sjkh 462311SjkhOn 4.3, they'd look a little bit better, but not much: 472311Sjkh 482311Sjkh 5 * * * * uucp /usr/lib/uucp/uudemon.hr 492311Sjkh 10 4 * * * uucp /usr/lib/uucp/uudemon.day 502311Sjkh 15 5 * * 0 uucp /usr/lib/uucp/uudemon.wk 512311Sjkh 522311SjkhFor this cron, you'd create /usr/lib/uucp/crontab.src (or wherever you want 532311Sjkhto keep uucp's commands) which would look like this: 542311Sjkh 552311Sjkh # /usr/lib/uucp/crontab.src - uucp's crontab 562311Sjkh # 572311Sjkh PATH=/usr/lib/uucp:/bin:/usr/bin 582311Sjkh SHELL=/bin/sh 592311Sjkh HOME=/usr/lib/uucp 602311Sjkh # 612311Sjkh 5 * * * * uudemon.hr 622311Sjkh 10 4 * * * uudemon.day 632311Sjkh 15 5 * * 0 uudemon.wk 642311Sjkh 652311SjkhThe application to the `news' cron commands (if any) is left for you to 662311Sjkhfigure out. Likewise if there are any other cruddy-looking 'su' commands in 672311Sjkhyour crontab commands, you don't need them anymore: just find a good place 682311Sjkhto put the `crontab.src' (or whatever you want to call it) file for that 692311Sjkhuser, put the cron commands into it, and install it using the `crontab' 702311Sjkhcommand (probably with "-u USERNAME", but see the man page). 712311Sjkh 722311SjkhIf you run a 4.2-derived cron, you could of course just install your current 732311Sjkhcrontab in toto as root's crontab. It would work exactly the way your 742311Sjkhcurrent one does, barring the extra steps in installing or changing it. 752311SjkhThere would still be advantages to this cron, mostly that you get mail if 762311Sjkhthere is any output from your cron commands. 772311Sjkh 782311SjkhOne note about getting mail from cron: you will probably find, after you 792311Sjkhinstall this version of cron, that your cron commands are generating a lot 802311Sjkhof irritating output. The work-around for this is to redirect all EXPECTED 812311Sjkhoutput to a per-execution log file, which you can examine if you want to 822311Sjkhsee the output from the "last time" a command was executed; if you get any 832311SjkhUNEXPECTED output, it will be mailed to you. This takes a while to get 842311Sjkhright, but it's amazingly convenient. Trust me. 852311Sjkh 86