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