1*0061c6a5SchristosId: CONVERSION,v 1.1.1.1 1996/12/16 19:39:48 halley Exp 2*0061c6a5Schristos 3*0061c6a5SchristosConversion of BSD 4.[23] crontab files: 4*0061c6a5Schristos 5*0061c6a5SchristosEdit your current crontab (/usr/lib/crontab) into little pieces, with each 6*0061c6a5Schristosusers' commands in a different file. This is different on 4.2 and 4.3, 7*0061c6a5Schristosbut I'll get to that below. The biggest feature of this cron is that you 8*0061c6a5Schristoscan move 'news' and 'uucp' cron commands into files owned and maintainable 9*0061c6a5Schristosby those two users. You also get to rip all the fancy 'su' footwork out 10*0061c6a5Schristosof the cron commands. On 4.3, there's no need for the 'su' stuff since the 11*0061c6a5Schristosuser name appears on each command -- but I'd still rather have separate 12*0061c6a5Schristoscrontabs with seperate environments and so on. 13*0061c6a5Schristos 14*0061c6a5SchristosLeave the original /usr/lib/crontab! This cron doesn't use it, so you may 15*0061c6a5Schristosas well keep it around for a while in case something goes wakko with this 16*0061c6a5Schristosfancy version. 17*0061c6a5Schristos 18*0061c6a5SchristosMost commands in most crontabs are run by root, have to run by root, and 19*0061c6a5Schristosshould continue to be run by root. They still have to be in their own file; 20*0061c6a5SchristosI recommend /etc/crontab.src or /usr/adm/crontab.src. 21*0061c6a5Schristos 22*0061c6a5Schristos'uucp's commands need their own file; how about /usr/lib/uucp/crontab.src? 23*0061c6a5Schristos'news' also, perhaps in /usr/lib/news/crontab.src... 24*0061c6a5Schristos 25*0061c6a5SchristosI say `how about' and `perhaps' because it really doesn't matter to anyone 26*0061c6a5Schristos(except you) where you put the crontab source files. The `crontab' command 27*0061c6a5SchristosCOPIES them into a protected directory (CRONDIR/SPOOL_DIR in cron.h), named 28*0061c6a5Schristosafter the user whose crontab it is. If you want to examine, replace, or 29*0061c6a5Schristosdelete a crontab, the `crontab' command does all of those things. The 30*0061c6a5Schristosvarious `crontab.src' (my suggested name for them) files are just source 31*0061c6a5Schristosfiles---they have to be copied to SPOOLDIR using `crontab' before they'll be 32*0061c6a5Schristosexecuted. 33*0061c6a5Schristos 34*0061c6a5SchristosOn 4.2, your crontab might have a few lines like this: 35*0061c6a5Schristos 36*0061c6a5Schristos 5 * * * * su uucp < /usr/lib/uucp/uudemon.hr 37*0061c6a5Schristos 10 4 * * * su uucp < /usr/lib/uucp/uudemon.day 38*0061c6a5Schristos 15 5 * * 0 su uucp < /usr/lib/uucp/uudemon.wk 39*0061c6a5Schristos 40*0061c6a5Schristos...or like this: 41*0061c6a5Schristos 42*0061c6a5Schristos 5 * * * * echo /usr/lib/uucp/uudemon.hr | su uucp 43*0061c6a5Schristos 10 4 * * * echo /usr/lib/uucp/uudemon.day | su uucp 44*0061c6a5Schristos 15 5 * * 0 echo /usr/lib/uucp/uudemon.wk | su uucp 45*0061c6a5Schristos 46*0061c6a5SchristosOn 4.3, they'd look a little bit better, but not much: 47*0061c6a5Schristos 48*0061c6a5Schristos 5 * * * * uucp /usr/lib/uucp/uudemon.hr 49*0061c6a5Schristos 10 4 * * * uucp /usr/lib/uucp/uudemon.day 50*0061c6a5Schristos 15 5 * * 0 uucp /usr/lib/uucp/uudemon.wk 51*0061c6a5Schristos 52*0061c6a5SchristosFor this cron, you'd create /usr/lib/uucp/crontab.src (or wherever you want 53*0061c6a5Schristosto keep uucp's commands) which would look like this: 54*0061c6a5Schristos 55*0061c6a5Schristos # /usr/lib/uucp/crontab.src - uucp's crontab 56*0061c6a5Schristos # 57*0061c6a5Schristos PATH=/usr/lib/uucp:/bin:/usr/bin 58*0061c6a5Schristos SHELL=/bin/sh 59*0061c6a5Schristos HOME=/usr/lib/uucp 60*0061c6a5Schristos # 61*0061c6a5Schristos 5 * * * * uudemon.hr 62*0061c6a5Schristos 10 4 * * * uudemon.day 63*0061c6a5Schristos 15 5 * * 0 uudemon.wk 64*0061c6a5Schristos 65*0061c6a5SchristosThe application to the `news' cron commands (if any) is left for you to 66*0061c6a5Schristosfigure out. Likewise if there are any other cruddy-looking 'su' commands in 67*0061c6a5Schristosyour crontab commands, you don't need them anymore: just find a good place 68*0061c6a5Schristosto put the `crontab.src' (or whatever you want to call it) file for that 69*0061c6a5Schristosuser, put the cron commands into it, and install it using the `crontab' 70*0061c6a5Schristoscommand (probably with "-u USERNAME", but see the man page). 71*0061c6a5Schristos 72*0061c6a5SchristosIf you run a 4.2-derived cron, you could of course just install your current 73*0061c6a5Schristoscrontab in toto as root's crontab. It would work exactly the way your 74*0061c6a5Schristoscurrent one does, barring the extra steps in installing or changing it. 75*0061c6a5SchristosThere would still be advantages to this cron, mostly that you get mail if 76*0061c6a5Schristosthere is any output from your cron commands. 77*0061c6a5Schristos 78*0061c6a5SchristosOne note about getting mail from cron: you will probably find, after you 79*0061c6a5Schristosinstall this version of cron, that your cron commands are generating a lot 80*0061c6a5Schristosof irritating output. The work-around for this is to redirect all EXPECTED 81*0061c6a5Schristosoutput to a per-execution log file, which you can examine if you want to 82*0061c6a5Schristossee the output from the "last time" a command was executed; if you get any 83*0061c6a5SchristosUNEXPECTED output, it will be mailed to you. This takes a while to get 84*0061c6a5Schristosright, but it's amazingly convenient. Trust me. 85*0061c6a5Schristos 86