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