xref: /dflybsd-src/usr.sbin/cron/doc/MAIL (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino[ this is really old mail that came to me in response to my 1986 posting
286d7f5d3SJohn Marino  to usenet asking for feature suggestions before releasing the first
386d7f5d3SJohn Marino  version of cron.  it is presented here for its entertainment value.
486d7f5d3SJohn Marino  --vix ]
586d7f5d3SJohn Marino
686d7f5d3SJohn Marino$FreeBSD: src/usr.sbin/cron/doc/MAIL,v 1.4 1999/08/28 01:15:53 peter Exp $
786d7f5d3SJohn Marino$DragonFly: src/usr.sbin/cron/doc/MAIL,v 1.2 2003/06/17 04:29:53 dillon Exp $
886d7f5d3SJohn Marino
986d7f5d3SJohn MarinoFrom ptsfa!lll-crg!ames!acornrc!bob Wed Dec 31 10:07:08 1986
1086d7f5d3SJohn MarinoDate: Wed, 31 Dec 86 08:59:31 pst
1186d7f5d3SJohn MarinoFrom: lll-crg!ames!acornrc!bob (Bob Weissman)
1286d7f5d3SJohn MarinoTo: ptsfa!vixie!paul
1386d7f5d3SJohn MarinoStatus: RO
1486d7f5d3SJohn Marino
1586d7f5d3SJohn MarinoSure, here's a suggestion: I'd like to be able to run a program, say,
1686d7f5d3SJohn Marinoevery two hours.  Current cron requires me to write
1786d7f5d3SJohn Marino0,2,4,6,8,10,12,14,16,18,20,22 in the hours field.  How about a notation
1886d7f5d3SJohn Marinoto handle this more elegantly?
1986d7f5d3SJohn Marino
2086d7f5d3SJohn Marino<<	Okay, I've allowed 0-22/2 as a means of handling this.
2186d7f5d3SJohn Marino	The time specification for my cron is as follows:
2286d7f5d3SJohn Marino		specification = range {"," range}
2386d7f5d3SJohn Marino		range = (start "-" finish ["/" step]) | single-unit
2486d7f5d3SJohn Marino	This allows "1,3,5-7", which the current cron doesn't (it won't
2586d7f5d3SJohn Marino	do a range inside a list), and handles your specific need.	>>
2686d7f5d3SJohn Marino
2786d7f5d3SJohn MarinoFrom drw@mit-eddie Wed Dec 31 18:25:27 1986
2886d7f5d3SJohn MarinoDate: Wed, 31 Dec 86 14:28:19 est
2986d7f5d3SJohn MarinoFrom: drw@mit-eddie (Dale Worley)
3086d7f5d3SJohn MarinoTo: mit-eddie!vixie!paul
3186d7f5d3SJohn MarinoStatus: RO
3286d7f5d3SJohn Marino
3386d7f5d3SJohn MarinoWe have a lot of lines in our crontab of the form
3486d7f5d3SJohn Marino
3586d7f5d3SJohn Marino	00 12 * * * su user < /usr/users/user/script.file
3686d7f5d3SJohn Marino
3786d7f5d3SJohn MarinoThis barfs (silently!) on our system (Dec Ultrix 1.2 == 4.2bsd) if
3886d7f5d3SJohn Marinouser's shell is csh.  This, I am told, is because csh requires that
3986d7f5d3SJohn Marinothe environment be set up in certain ways, which cron doesn't do.
4086d7f5d3SJohn Marino(Actually, I believe, it is because /etc/rc, which runs cron, doesn't
4186d7f5d3SJohn Marinoset up the environment enough for csh to run, and cron just inherits
4286d7f5d3SJohn Marinothe situation.)  Anyway, the point is that if you find out what csh
4386d7f5d3SJohn Marinoreally needs in its environment, you might want to set up cron to
4486d7f5d3SJohn Marinoprovide some reasonable defaults (if it isn't supplied by cron's
4586d7f5d3SJohn Marinoparent).  Also, could you tell me what csh needs, if you find out, so
4686d7f5d3SJohn Marinowe can hack our /etc/rc?
4786d7f5d3SJohn Marino
4886d7f5d3SJohn Marino<<	well, the environment IS a problem. processes that cron forks
4986d7f5d3SJohn Marino	will inherit the environment of the person who ran the cron
5086d7f5d3SJohn Marino	daemon... I plan to edit out such useless things as TERMCAP,
5186d7f5d3SJohn Marino	TERM, and the like; supply correct values for HOME, USER, CWD,
5286d7f5d3SJohn Marino	and whatever else comes to mind.  I'll make sure csh works...	>>
5386d7f5d3SJohn MarinoFrom ptsfa!ames!seismo!dgis!generous Thu Jan  1 07:33:17 1987
5486d7f5d3SJohn MarinoDate: Thu Jan 1 10:29:20 1987
5586d7f5d3SJohn MarinoFrom: ames!seismo!dgis!generous (Curtis Generous)
5686d7f5d3SJohn MarinoTo: nike!ptsfa!vixie!paul
5786d7f5d3SJohn MarinoStatus: RO
5886d7f5d3SJohn Marino
5986d7f5d3SJohn MarinoPaul:
6086d7f5d3SJohn Marino
6186d7f5d3SJohn MarinoOne of the limitations of the present versions of cron is the lack
6286d7f5d3SJohn Marinoof the capability of specifying a way to execute a command every
6386d7f5d3SJohn Marinon units of time.
6486d7f5d3SJohn Marino
6586d7f5d3SJohn MarinoHere is a good example:
6686d7f5d3SJohn Marino
6786d7f5d3SJohn Marino# Present method to start up uucico
6886d7f5d3SJohn Marino02,12,22,32,42,52 * * * * 	exec /usr/lib/uucp/uucico -r1
6986d7f5d3SJohn Marino
7086d7f5d3SJohn Marino# New method ?? (the ':' here is just one possibility for syntax)
7186d7f5d3SJohn Marino02:10 * * * *			exec /usr/lib/uucp/uucico -r1
7286d7f5d3SJohn Marino
7386d7f5d3SJohn MarinoThis method would prove very helpful for those programs that get started
7486d7f5d3SJohn Marinoevery few minutes, making the entry long and not easily readable.  The first
7586d7f5d3SJohn Marinonumber would specify the base time, and the second number the repetition
7686d7f5d3SJohn Marinointerval.
7786d7f5d3SJohn Marino
7886d7f5d3SJohn Marino<<	Good idea, but bob@acornrc beat you to it.  I used '/' instead of
7986d7f5d3SJohn Marino	':'.  This is my personal preference, and seems intuitive when you
8086d7f5d3SJohn Marino	think of the divide operator in C... Does anyone have a preference? >>
8186d7f5d3SJohn Marino
8286d7f5d3SJohn MarinoFrom ptsfa!lll-lcc!seismo!decuac!c3pe!c3engr!charles Thu Jan  1 17:04:24 1987
8386d7f5d3SJohn MarinoFrom: lll-lcc!seismo!c3pe!c3engr!charles (Charles Green)
8486d7f5d3SJohn MarinoTo: c3pe!decuac!dolqci!vrdxhq!seismo!lll-lcc!ptsfa!vixie!paul
8586d7f5d3SJohn MarinoDate: Thu Jan  1 19:22:47 1987
8686d7f5d3SJohn MarinoStatus: RO
8786d7f5d3SJohn Marino
8886d7f5d3SJohn MarinoWell, this isn't a compatible extension, but I have in times past wondered
8986d7f5d3SJohn Marinoabout a facility to let you start a process at intervals of, say, 17 minutes,
9086d7f5d3SJohn Marinoinstead of particular minutes out of each hour.
9186d7f5d3SJohn Marino
9286d7f5d3SJohn Marino<<	This was a popular request!	>>
9386d7f5d3SJohn Marino
9486d7f5d3SJohn MarinoFrom seismo!uwvax!astroatc!nicmad!norvax!mann Sun Jan  4 13:04:01 1987
9586d7f5d3SJohn MarinoDate: Fri, 2 Jan 87 09:23:53 cst
9686d7f5d3SJohn MarinoFrom: lll-lcc!seismo!uwvax!astroatc!nicmad!norvax!mann (Tom Mann)
9786d7f5d3SJohn MarinoTo: ptsfa!vixie!paul
9886d7f5d3SJohn MarinoStatus: RO
9986d7f5d3SJohn Marino
10086d7f5d3SJohn MarinoI'm not sure if it is in cron (either SysV or BSD ... if it is, I haven't
10186d7f5d3SJohn Marinofigured it out ) but a comment feature would SURE BE NICE!.
10286d7f5d3SJohn MarinoThere are times when I want to comment out an entry
10386d7f5d3SJohn Marinofor a period of time; it might also make it a lot more legible.
10486d7f5d3SJohn Marino
10586d7f5d3SJohn Marino<<	My cron allows blank lines and standard #-type comments.  I know
10686d7f5d3SJohn Marino	that one BSD4.2 cron I've used had it.  I don't know about SysV.  >>
10786d7f5d3SJohn Marino
10886d7f5d3SJohn MarinoFrom ptsfa!hoptoad!hugh Mon Jan  5 10:26:46 1987
10986d7f5d3SJohn MarinoDate: Mon, 5 Jan 87 01:22:17 PST
11086d7f5d3SJohn MarinoFrom: hoptoad!hugh (Hugh Daniel)
11186d7f5d3SJohn MarinoTo: ptsfa!vixie!paul
11286d7f5d3SJohn MarinoStatus: RO
11386d7f5d3SJohn Marino
11486d7f5d3SJohn Marino  Hi, I do have a BIG one that I would like.  I want to log ALL output
11586d7f5d3SJohn Marinofrom command lines into a file for each line.  Thus I might have a chance
11686d7f5d3SJohn Marinoof finding out why my crontab entry did not work.
11786d7f5d3SJohn Marino  This would seem to work best if done by cron, as it is now I have a google
11886d7f5d3SJohn Marinoof shell scripts laying about just to put the error output where I can see
11986d7f5d3SJohn Marinoit.
12086d7f5d3SJohn Marino
12186d7f5d3SJohn Marino<<	My cron (and the SysV cron) will send mail to the owner of the
12286d7f5d3SJohn Marino	particular crontab file if a command generates any output on stdout
12386d7f5d3SJohn Marino	or stderr.  This can be irritating, but if you write a script such
12486d7f5d3SJohn Marino	that any output means a problem occurred, you can avoid most logfile
12586d7f5d3SJohn Marino	needs, and not generate mail except in unforeseen circumstances.   >>
12686d7f5d3SJohn Marino
12786d7f5d3SJohn MarinoFrom ptsfa!dual!ucbvax!ihnp4!anvil!es!Robert_Toxen Mon Jan  5 13:08:46 1987
12886d7f5d3SJohn MarinoFrom: dual!ucbvax!ihnp4!anvil!es!Robert_Toxen
12986d7f5d3SJohn MarinoDate: Fri,  2 Jan 87 14:25:29 EST
13086d7f5d3SJohn MarinoTo: anvil!ihnp4!ucbvax!dual!ptsfa!vixie!paul
13186d7f5d3SJohn MarinoStatus: RO
13286d7f5d3SJohn Marino
13386d7f5d3SJohn MarinoHere are some suggestions:
13486d7f5d3SJohn Marino1. Run it through the C preprocessor via "/lib/<whatever>".
13586d7f5d3SJohn Marino
13686d7f5d3SJohn Marino<<	hmmm. this seems of limited utility, and if you really wanted
13786d7f5d3SJohn Marino	to do it that way, you could do it yourself (since users can
13886d7f5d3SJohn Marino	write to their own crontab files).  I'll add '-' (read stdin)
13986d7f5d3SJohn Marino	to the crontab installer program to facilitate this.		>>
14086d7f5d3SJohn Marino
14186d7f5d3SJohn Marino2. Allow specifying every Nth day of week, i.e., every second Wednesday.
14286d7f5d3SJohn Marino   I did this to calendar by separating the day of week (Wed=4, which one
14386d7f5d3SJohn Marino   to start on and N with slashes).  I took modulo the day of year as a
14486d7f5d3SJohn Marino   starting point so that someone with a desk calendar documenting such
14586d7f5d3SJohn Marino   things can easily determine the offset (second number).  I did this
14686d7f5d3SJohn Marino   while at SGI; alas I don't have a copy of the code.
14786d7f5d3SJohn Marino
14886d7f5d3SJohn Marino<<	I can see how this could be useful, but I'm not sure how I'd
14986d7f5d3SJohn Marino	implement it.  Cron currently doesn't keep track of the last time
15086d7f5d3SJohn Marino	a given command was run; whether the current Wednesday is the first
15186d7f5d3SJohn Marino	or second since the command was last run would be pretty hard to
15286d7f5d3SJohn Marino	figure out.  I'd have to keep a database of commands and their
15386d7f5d3SJohn Marino	execution around, and purge it when the crontab was overwritten.
15486d7f5d3SJohn Marino	This is too much work for me, but if someone adds it, let me know.  >>
15586d7f5d3SJohn Marino
15686d7f5d3SJohn MarinoFrom ptsfa!ames!seismo!cbmvax!devon!paul Tue Jan  6 05:50:17 1987
15786d7f5d3SJohn MarinoFrom: ames!seismo!cbmvax!devon!paul
15886d7f5d3SJohn MarinoTo: cbmvax!seismo!nike!ptsfa!vixie!paul
15986d7f5d3SJohn MarinoDate: Mon Jan  5 09:29:57 1987
16086d7f5d3SJohn MarinoStatus: RO
16186d7f5d3SJohn Marino
16286d7f5d3SJohn MarinoOne problem that has always plagued me with cron is the assumed ORing.
16386d7f5d3SJohn MarinoI'd like to see some type of ANDing implemented.  I guess I can best
16486d7f5d3SJohn Marinodescribe this by example.  Say I have the following line in my crontab
16586d7f5d3SJohn Marinofile:
16686d7f5d3SJohn Marino
16786d7f5d3SJohn Marino*  *  4-31  *  1-6	/usr/bin/command
16886d7f5d3SJohn Marino
16986d7f5d3SJohn MarinoWhat this does is run 'command' on the 4th thru 31st days of the
17086d7f5d3SJohn Marinomonth, AND on Monday thru Saturday; which probably means running it
17186d7f5d3SJohn Marinoevery day of the month (unless Sunday falls on days 1-3).  This
17286d7f5d3SJohn Marinohappens because cron runs the command if the day-of-month OR the
17386d7f5d3SJohn Marinoday-of-week is true.
17486d7f5d3SJohn Marino
17586d7f5d3SJohn MarinoWhat I'd like to happen with the above line is to run the command ONLY
17686d7f5d3SJohn Marinoon Monday thru Saturday any time after the 3rd of the month, e.g. if
17786d7f5d3SJohn Marinothe day-of-month AND the day-of-week are true.
17886d7f5d3SJohn Marino
17986d7f5d3SJohn MarinoMy proposal to you is to implement some special chars for the first
18086d7f5d3SJohn Marinofive fields.  Examples:
18186d7f5d3SJohn Marino
18286d7f5d3SJohn Marino*  *  !1-3  *  1-6	/usr/bin/command
18386d7f5d3SJohn Marino
18486d7f5d3SJohn Marino(run command Mon-Sat, but NOT [!] on the first 3 days of the month)
18586d7f5d3SJohn Marino
18686d7f5d3SJohn Marino*  *  &4-31 *  &1-6	/usr/bin/command
18786d7f5d3SJohn Marino
18886d7f5d3SJohn Marino(run command if day-of-month AND day-of-week are true)
18986d7f5d3SJohn Marino
19086d7f5d3SJohn MarinoGet the picture?  This would be compatable with existing versions of
19186d7f5d3SJohn Marinocron (which wouldn't currently be using any special characters, so
19286d7f5d3SJohn Marinothat old crontabs would be handled correctly).
19386d7f5d3SJohn Marino
19486d7f5d3SJohn Marino<<	This message made me aware of the actual boolean expression involved
19586d7f5d3SJohn Marino	in a crontab entry.  I'd assumed that it was
19686d7f5d3SJohn Marino		(minute && hour && DoM && month && DoW)
19786d7f5d3SJohn Marino	But it's really
19886d7f5d3SJohn Marino		(minute && hour && month && (DoM || DoW))
19986d7f5d3SJohn Marino
20086d7f5d3SJohn Marino	I can see some value in changing this, but with a fixed order of
20186d7f5d3SJohn Marino	fields, operators get to be kindof unary, which && and || really
20286d7f5d3SJohn Marino	aren't.  If someone has an idea on a syntax that allows useful
20386d7f5d3SJohn Marino	variations to the standard (&& && && (||)) default, please suggest. >>
20486d7f5d3SJohn Marino
20586d7f5d3SJohn MarinoFrom bobkat!pedz Tue Jan  6 20:02:10 1987
20686d7f5d3SJohn MarinoFrom: pedz@bobkat.UUCP (Pedz Thing)
20786d7f5d3SJohn MarinoDate: 2 Jan 87 17:34:44 GMT
20886d7f5d3SJohn MarinoStatus: RO
20986d7f5d3SJohn Marino
21086d7f5d3SJohn MarinoLog files!  It would be nice to be able to specify a log for cron
21186d7f5d3SJohn Marinoitself and also a log for each program's stdout and stderr to go to.
21286d7f5d3SJohn MarinoThe latter can of course be done with > and 2> but it would be nice if
21386d7f5d3SJohn Marinothere could be a single line with some sort of pattern like
21486d7f5d3SJohn Marino`> /usr/spool/log/%' and the command would be substituted for the %.
21586d7f5d3SJohn MarinoAnother thing which would be nice is to be able to specify which shell
21686d7f5d3SJohn Marinoto call to give the command to.
21786d7f5d3SJohn Marino
21886d7f5d3SJohn Marino<<	Log files are done with mail.  The '%' idea could be useful if
21986d7f5d3SJohn Marino	a different character were used (% is special to cron, see man
22086d7f5d3SJohn Marino	page); a different directory would have to be chosen, since each
22186d7f5d3SJohn Marino	user has their own crontab file; and something intelligent would
22286d7f5d3SJohn Marino	have to be done in the file naming, since the first word of the
22386d7f5d3SJohn Marino	command might be ambiguous (with other commands).  In short, it's
22486d7f5d3SJohn Marino	too much work.  Sorry.						  >>
22586d7f5d3SJohn Marino
22686d7f5d3SJohn MarinoFrom guy%gorodish@sun Tue Jan  6 20:03:13 1987
22786d7f5d3SJohn MarinoFrom: guy%gorodish@sun (Guy Harris)
22886d7f5d3SJohn MarinoMessage-ID: <10944@sun.uucp>
22986d7f5d3SJohn MarinoDate: 5 Jan 87 12:09:09 GMT
23086d7f5d3SJohn MarinoReferences: <429@vixie.UUCP> <359@bobkat.UUCP>
23186d7f5d3SJohn MarinoSender: news@sun.uucp
23286d7f5d3SJohn MarinoStatus: RO
23386d7f5d3SJohn Marino
23486d7f5d3SJohn Marino> Another thing which would be nice is to be able to specify which shell
23586d7f5d3SJohn Marino> to call to give the command to.
23686d7f5d3SJohn Marino
23786d7f5d3SJohn MarinoWell, the obvious choice would be the user's shell, but this wouldn't work
23886d7f5d3SJohn Marinofor accounts like "uucico".
23986d7f5d3SJohn Marino
24086d7f5d3SJohn Marino<<	I use the owning user's shell, and to handle "uucico" I check a
24186d7f5d3SJohn Marino	list of "acceptable shells" (currently compiled in, does anybody
24286d7f5d3SJohn Marino	mind?), substituting a default (compiled in) shell if the user's
24386d7f5d3SJohn Marino	shell isn't on the list.
24486d7f5d3SJohn Marino
24586d7f5d3SJohn Marino	BTW, "compiled in" means that it's in a .h file, easily changed
24686d7f5d3SJohn Marino	during installation, but requiring recompilation to modify.  You
24786d7f5d3SJohn Marino	don't have to go digging through the code to find it...		  >>
24886d7f5d3SJohn Marino
24986d7f5d3SJohn MarinoFrom qantel!hplabs!ucbvax!mwm@violet.berkeley.edu Tue Jan  6 21:24:48 1987
25086d7f5d3SJohn MarinoTo: hplabs!qantel!vixie!paul (Paul Vixie Esq)
25186d7f5d3SJohn MarinoDate: 04 Jan 87 00:42:35 PST (Sun)
25286d7f5d3SJohn MarinoFrom: Mike Meyer <mwm@violet.berkeley.edu>
25386d7f5d3SJohn MarinoStatus: RO
25486d7f5d3SJohn Marino
25586d7f5d3SJohn Marino<<[Discussion of RMS/FSF, and mwm's GNU Cron deleted]>>
25686d7f5d3SJohn Marino
25786d7f5d3SJohn MarinoOh, yeah - here are the extensions on my cron:
25886d7f5d3SJohn Marino
25986d7f5d3SJohn Marino1) Sunday is both day 0 and day 7, so it complies with both SysV and
26086d7f5d3SJohn MarinoBSD cron.
26186d7f5d3SJohn Marino
26286d7f5d3SJohn Marino<<	Good idea. I did it too, thanks for informing me.	>>
26386d7f5d3SJohn Marino
26486d7f5d3SJohn Marino2) At is integrated into the cron. Instead of atrun to scan the
26586d7f5d3SJohn Marino/usr/spool/at directory, at files are put into the /usr/lib/cron
26686d7f5d3SJohn Marinodirectory along with users cron files, and cron fabricates a line from
26786d7f5d3SJohn Marinoa crontab file to run them. This is considered a major win by all who
26886d7f5d3SJohn Marinouse it.
26986d7f5d3SJohn Marino
27086d7f5d3SJohn Marino<<	I don't use 'at', and my cron doesn't do anything with it.  To run
27186d7f5d3SJohn Marino	'at', I use 'atrun' the same way the current BSD cron does.  My
27286d7f5d3SJohn Marino	crontab files are in /usr/spool/cron/crontabs, in the SysV
27386d7f5d3SJohn Marino	tradition -- not in /usr/lib/cron.  This is a configuration
27486d7f5d3SJohn Marino	parameter, of course.						>>
27586d7f5d3SJohn Marino
27686d7f5d3SJohn MarinoThere are two known restrictions:
27786d7f5d3SJohn Marino
27886d7f5d3SJohn Marino1) I don't support any of the SysV security hooks. I don't have a use
27986d7f5d3SJohn Marinofor them, and RMS didn't like the idea at all :-).
28086d7f5d3SJohn Marino
28186d7f5d3SJohn Marino<<	This means cron.allow and cron.deny.  I plan to support them, as
28286d7f5d3SJohn Marino	they've been quite helpful at various HPUX sites I've administered. >>
28386d7f5d3SJohn Marino
28486d7f5d3SJohn Marino2) Cron expects to be able to create files with names longer than 14
28586d7f5d3SJohn Marinocharacters, which makes it hard to run on SysV. At least one person
28686d7f5d3SJohn Marinowas working on a port, but I don't know how it's going. That might
28786d7f5d3SJohn Marinomake for a good reason for releasing yours, right there.
28886d7f5d3SJohn Marino
28986d7f5d3SJohn Marino<<	If someone has SysV (with the 14-character limit), they probably
29086d7f5d3SJohn Marino	won't want my cron, since it doesn't add much to the standard
29186d7f5d3SJohn Marino	version (which they may have support for).  My cron is not currently
29286d7f5d3SJohn Marino	portable to non-BSD systems, since it relies on interval timers (I
29386d7f5d3SJohn Marino	needed to sleep for intervals more granular than seconds alone would
29486d7f5d3SJohn Marino	allow).  The port would be trivial, and I will do it if a lot of
29586d7f5d3SJohn Marino	people ask for it...						>>
29686d7f5d3SJohn Marino
29786d7f5d3SJohn MarinoOh, yeah - I'm going to see about getting this cron integrated into
29886d7f5d3SJohn Marinothe next 4BSD release.
29986d7f5d3SJohn Marino
30086d7f5d3SJohn Marino<<	How does one go about this?  I have a few nifty gadgets I'd like
30186d7f5d3SJohn Marino	to contribute, this cron being one of them...			>>
30286d7f5d3SJohn Marino
30386d7f5d3SJohn Marino<<[more FSF/GNU discussion deleted]>>
30486d7f5d3SJohn Marino
30586d7f5d3SJohn MarinoFrom qantel!hplabs!ames!ut-sally!ut-ngp!melpad!bigtex!james Tue Jan  6 21:24:57 1987
30686d7f5d3SJohn MarinoPosted-Date: Fri, 2 Jan 87 19:26:16 est
30786d7f5d3SJohn MarinoDate: Fri, 2 Jan 87 19:26:16 est
30886d7f5d3SJohn MarinoFrom: hplabs!ames!ut-sally!ut-ngp!bigtex!james
30986d7f5d3SJohn MarinoTo: vixie!paul
31086d7f5d3SJohn MarinoStatus: RO
31186d7f5d3SJohn Marino
31286d7f5d3SJohn MarinoYes!!!  There are several critical failures in System V cron...
31386d7f5d3SJohn Marino
31486d7f5d3SJohn Marino1. Pass all variables in cron's environment into the environment of things
31586d7f5d3SJohn Marino   cron starts up, or at least into the crontab entries started up (at jobs
31686d7f5d3SJohn Marino   will inherit the environment of the user).  If nothing else it is critically
31786d7f5d3SJohn Marino   important that the TZ variable be passed on.  PATH should be passed on too.
31886d7f5d3SJohn Marino   Basically, passing environment values allows one to design a standard
31986d7f5d3SJohn Marino   environment with TZ and PATH and have that run by everything.  If anyone
32086d7f5d3SJohn Marino   tells you this is no big deal, consider what happens when uucico is
32186d7f5d3SJohn Marino   started by cron in CA to make a long distance phone link...  Unless the
32286d7f5d3SJohn Marino   administrator is really on his/her toes, calls scheduled at 5pm will really
32386d7f5d3SJohn Marino   go at two in the afternoon, needlessly incurring huge phone bills, all
32486d7f5d3SJohn Marino   because System V refuses to pass the TZ from its environment down.  There
32586d7f5d3SJohn Marino   are work arounds, but only putting it in cron will really work.  This is
32686d7f5d3SJohn Marino   not a security hole.
32786d7f5d3SJohn Marino
32886d7f5d3SJohn Marino<<	delete TERM and TERMCAP; modify HOME, USER, and CWD; pass TZ and
32986d7f5d3SJohn Marino	PATH through undisturbed.  any other requests out there?
33086d7f5d3SJohn Marino
33186d7f5d3SJohn Marino	BSD doesn't have this problem -- TZ is passed right on through if
33286d7f5d3SJohn Marino	you define it in the shell before starting my cron daemon.  However,
33386d7f5d3SJohn Marino	the BSD I'm running this on doesn't need TZ to be defined anyway...
33486d7f5d3SJohn Marino	The default in the kernel has been just fine so far...  But just the
33586d7f5d3SJohn Marino	same, if/when I port to SysV (I guess I really should), I'll make
33686d7f5d3SJohn Marino	sure this works right.
33786d7f5d3SJohn Marino
33886d7f5d3SJohn Marino	I guess I've been spoiled.  HPUX is SysV-based, and I never had a
33986d7f5d3SJohn Marino	problem with cron and TZ when I used it.			  >>
34086d7f5d3SJohn Marino
34186d7f5d3SJohn Marino2. A way to avoid logging stuff in /usr/lib/cron/log.  I have a cron entry
34286d7f5d3SJohn Marino   run uudemon.hr every 10 minutes.  This is 144 times/day.  Each run generates
34386d7f5d3SJohn Marino   three lines of text, for a total of 432 lines of text I don't want to see.
34486d7f5d3SJohn Marino   Obviously this should be optional, but it would be nice if there were a
34586d7f5d3SJohn Marino   way to flag an entry so that it wasn't logged at all unless there was an
34686d7f5d3SJohn Marino   error.
34786d7f5d3SJohn Marino
34886d7f5d3SJohn Marino<<	I don't know nothin' 'bout no /usr/lib/cron/log.  What is this file?
34986d7f5d3SJohn Marino	I don't see any reason to create log entries, given the mail-the-
35086d7f5d3SJohn Marino	output behaviour.  Opinions, anyone?				>>
35186d7f5d3SJohn Marino
35286d7f5d3SJohn MarinoI will come up with other ideas no doubt, but I can always implement them
35386d7f5d3SJohn Marinomyself.
35486d7f5d3SJohn Marino
35586d7f5d3SJohn Marino<<	That's what I like about PD software.  Please send me the diffs!  >>
35686d7f5d3SJohn Marino
35786d7f5d3SJohn MarinoThe other problem you have is making sure you can run standard
35886d7f5d3SJohn Marinocrontabs.  I would suggest something like this: if the command part of the
35986d7f5d3SJohn Marinoentry starts with an unescaped -, then flags and options follow immediately
36086d7f5d3SJohn Marinothereafter.  As in:
36186d7f5d3SJohn Marino
36286d7f5d3SJohn Marino2,12,22,32,42,52 * * * * -q /usr/lib/uucp/uudemon.hr
36386d7f5d3SJohn Marino
36486d7f5d3SJohn MarinoThis could mean do not log the uudemon.hr run unless there is a problem of
36586d7f5d3SJohn Marinosome kind.  This is probably safe as not many filenames start with "-", and
36686d7f5d3SJohn Marinothose that do are already a problem for people.
36786d7f5d3SJohn Marino
36886d7f5d3SJohn Marino<<	Since I don't plan on supporting /usr/lib/cron/log in ANY form unless
36986d7f5d3SJohn Marino	many people request it, I won't be needing -q as you've defined it.
37086d7f5d3SJohn Marino	I could use something like this to avoid sending mail on errors, for
37186d7f5d3SJohn Marino	the occasional script that you don't want to bullet-proof.
37286d7f5d3SJohn Marino
37386d7f5d3SJohn Marino	The compatibility issue is CRITICAL.  The 4.3BSD crontab format is
37486d7f5d3SJohn Marino	a crime against the whole philosophy of Unix(TM), in my opinion.   >>
37586d7f5d3SJohn Marino
37686d7f5d3SJohn MarinoOne other minor thing to consider is the ulimit: can different users get
37786d7f5d3SJohn Marinodifferent ulimits for their crontab entries?
37886d7f5d3SJohn Marino
37986d7f5d3SJohn Marino<<	Boy I'm ignorant today.  What's a ulimit, and what should I do with
38086d7f5d3SJohn Marino	it in a crontab?  Suggestions, enlightenment, etc ??		   >>
38186d7f5d3SJohn Marino
38286d7f5d3SJohn MarinoFrom qantel!lll-crg!ames!uw-beaver!uw-nsr!john Tue Jan  6 23:32:44 1987
38386d7f5d3SJohn MarinoDate: Thu, 1 Jan 87 10:53:05 pst
38486d7f5d3SJohn MarinoFrom: lll-crg!ames!uw-beaver!uw-nsr!john (John Sambrook 5-7433)
38586d7f5d3SJohn MarinoTo: vixie!paul
38686d7f5d3SJohn MarinoStatus: RO
38786d7f5d3SJohn Marino
38886d7f5d3SJohn MarinoHow about not hardwiring the default environment that cron builds for its
38986d7f5d3SJohn Marinochildren in the cron program itself?  Our cron does this and it's the pits
39086d7f5d3SJohn Marinobecause we are TZ=PST8PDT not TZ=EST5EDT !
39186d7f5d3SJohn Marino
39286d7f5d3SJohn Marino<<	yeachk.  I assure you, I will not hardwire the TZ!		>>
39386d7f5d3SJohn MarinoFrom ptsfa!well!dv Fri Jan  9 04:01:50 1987
39486d7f5d3SJohn MarinoDate: Thu, 8 Jan 87 23:50:40 pst
39586d7f5d3SJohn MarinoFrom: well!dv (David W. Vezie)
39686d7f5d3SJohn MarinoTo: ptsfa!vixie!paul
39786d7f5d3SJohn MarinoStatus: RO
39886d7f5d3SJohn Marino
39986d7f5d3SJohn Marino6, have a special notation called 'H' which would expand to weekends
40086d7f5d3SJohn Marino   and holidays (you'd have to keep a database somewhere of real
40186d7f5d3SJohn Marino   holidays), and also 'W' for workdays (neither weekend or holiday).
40286d7f5d3SJohn Marino
40386d7f5d3SJohn Marino<<	Too much work.  There should be a standard way to define and
40486d7f5d3SJohn Marino	detect holidays under Unix(TM); if there were, I'd use it.  As
40586d7f5d3SJohn Marino	it is, I'll leave this for someone else to add.
40686d7f5d3SJohn Marino
40786d7f5d3SJohn Marino	I can see the usefulness; it just doesn't quite seem worth it.    >>
40886d7f5d3SJohn MarinoFrom qantel!gatech!akgua!blnt1!jat Wed Jan 14 20:00:40 1987
40986d7f5d3SJohn MarinoDate: Tue, 13 Jan 87 16:39:38 EST
41086d7f5d3SJohn MarinoFrom: gatech!akgua!blnt1!jat
41186d7f5d3SJohn MarinoStatus: RO
41286d7f5d3SJohn Marino
41386d7f5d3SJohn Marino1) Add some way to tell cron to reread the files, say kill -1 <pid>
41486d7f5d3SJohn Marino
41586d7f5d3SJohn Marino<<	whenever the 'crontab' program is run and updates a crontab file,
41686d7f5d3SJohn Marino	a file /usr/spool/cron/POKECRON is created; next time the cron
41786d7f5d3SJohn Marino	daemon wakes up, it sees it, and re-reads the crontab files.
41886d7f5d3SJohn Marino
41986d7f5d3SJohn Marino	I thought of handling the signal; even implemented it.  Then this
42086d7f5d3SJohn Marino	clever idea hit me and I ripped it all out and added a single
42186d7f5d3SJohn Marino	IF-statement to handle the POKECRON file.			>>
42286d7f5d3SJohn Marino
42386d7f5d3SJohn Marino2) Have some kind of retry time so that if a command fails, cron will try to
42486d7f5d3SJohn Marino   execute it again after a certain period.  This is useful if you have some
42586d7f5d3SJohn Marino   type of cleanup program that can run at the scheduled time for some reason
42686d7f5d3SJohn Marino   (such as locked device, unmounted filesystem, etc).
42786d7f5d3SJohn Marino
42886d7f5d3SJohn Marino<<	Hmmm, sounds useful.  I could do this by submitting an 'at' job...
42986d7f5d3SJohn Marino	I'll think about it.						>>
43086d7f5d3SJohn MarinoFrom ptsfa!dual!ucbvax!ihnp4!mtuxo!ender Sat Jan  3 16:54:00 1987
43186d7f5d3SJohn MarinoFrom: dual!ucbvax!ihnp4!mtuxo!ender
43286d7f5d3SJohn MarinoDate: Sat, 3 Jan 87 14:05:13 PST
43386d7f5d3SJohn MarinoTo: ucbvax!dual!ptsfa!vixie!paul
43486d7f5d3SJohn MarinoStatus: RO
43586d7f5d3SJohn Marino
43686d7f5d3SJohn MarinoIt would be nice if nonprivileged users can setup personal crontab files
43786d7f5d3SJohn Marino(~/.cronrc, say) and be able to run personal jobs at regular intervals.
43886d7f5d3SJohn Marino
43986d7f5d3SJohn Marino<<	this is done, but in the SysV style: the 'crontab' program installs
44086d7f5d3SJohn Marino	a new crontab file for the executing user (can be overridden by root
44186d7f5d3SJohn Marino	for setup of uucp and news).  the advantage of this is that (1) when
44286d7f5d3SJohn Marino	a crontab is changed, the daemon can be informed automatically; and
44386d7f5d3SJohn Marino	(2) the file can be syntax-checked before installation.		>>
44486d7f5d3SJohn MarinoFrom ptsfa!ames!seismo!ihnp4!lcc!richard Fri Jan 16 04:47:33 1987
44586d7f5d3SJohn MarinoDate: Fri, 16 Jan 87 07:44:57 EST
44686d7f5d3SJohn MarinoTo: nike!ptsfa!vixie!paul
44786d7f5d3SJohn MarinoStatus: RO
44886d7f5d3SJohn Marino
44986d7f5d3SJohn MarinoThe System V cron is nice, but it has a few annoying features.  One is that
45086d7f5d3SJohn Marinoits mail files will say that the previous message is the output of "one of your
45186d7f5d3SJohn Marinocron commands."  I wish it would say WHICH cron commmand.
45286d7f5d3SJohn Marino
45386d7f5d3SJohn Marino<<	Done.  Also which shell, which user (useful when the mail gets
45486d7f5d3SJohn Marino	forwarded), which home directory, and other useful crud.	>>
45586d7f5d3SJohn Marino
45686d7f5d3SJohn MarinoAnother problem is with timezones.  It is necessary to specify TZ=PST8PDT (or
45786d7f5d3SJohn Marinowhatever) when you invoke cron (from inittab, or /etc/rc) and it is also
45886d7f5d3SJohn Marinonecessary to add TZ=PST8PDT to each crontab line which might need it.  Cron
45986d7f5d3SJohn Marinoshould automatically export its idea of the "TZ" to each invoked command, and
46086d7f5d3SJohn Marinoit should be possible to put a line in the crontab file which overrides that
46186d7f5d3SJohn Marinofor every command in the file (e.g., most users are on EST, so cron is run
46286d7f5d3SJohn Marinowith TZ=EST5EDT; but one user is usually on PST and wants all of his cron
46386d7f5d3SJohn Marinocommands to run with TZ=PST8PDT).  This might be extended to allow any
46486d7f5d3SJohn Marinoenvironment variable to be specified once for the whole crontab file (e.g.,
46586d7f5d3SJohn MarinoPATH).
46686d7f5d3SJohn Marino
46786d7f5d3SJohn Marino<<	Well, since I run the user's shell, you could put this into .cshrc.
46886d7f5d3SJohn Marino	generic environment-variable setting could be useful, though.  Since
46986d7f5d3SJohn Marino	I have to modify the environment anyway, I'll consider this.	  >>
47086d7f5d3SJohn Marino
47186d7f5d3SJohn MarinoA log file might be a nice idea, but the System V cron log is too verbose.
47286d7f5d3SJohn MarinoI seem to remember that cron keeps it open, too; so you can't even have
47386d7f5d3SJohn Marinosomething go and periodically clean it out.
47486d7f5d3SJohn Marino
47586d7f5d3SJohn Marino<<	I don't do /usr/lib/cron/log.  I wasn't aware of this file until I
47686d7f5d3SJohn Marino	got all these suggestions.  Do people want this file?  Tell me!    >>
477