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