CRON w/o logging (reprise)
Joe Bob Willie
haugj at pigs.UUCP
Fri Aug 19 03:42:53 AEST 1988
In article <591 at sigmast.UUCP> dgy at sigmast.UUCP (Dave Yearke) writes:
>I had the same problem when we first got our 3b2/500. The answer to my
>problem turned out to be this: I had a weekly script that renamed the
>log file to Old-Log, and created an empty log file. This confused cron,
>because I believe it always has log open for write, and can't deal with
>the file disappearing or being modified by anything other than itself.
cron appears to have the file open for append at end of file, zeroing
the file seems to work just fine. moving it is a bad idea, however.
so, i copy the file to a new location and then zero the current log file.
here is the crontab entry which pertains to maintaining the log file
itself:
57 23 * * * cp /usr/lib/cron/log /usr/lib/cron/o.log ; date > /usr/lib/cron/log
and here are the first five lines of each to show how they look:
==> /usr/lib/cron/log <==
Thu Aug 18 00:57:01 EDT 1988
< root 27418 c Wed Aug 17 23:57:01 1988
> CMD: find /tmp ! -user root -atime +3 -exec rm {} \;
> root 27421 c Thu Aug 18 00:00:00 1988
> CMD: /usr/lib/sa/sa1 &
==> /usr/lib/cron/o.log <==
Wed Aug 17 00:57:00 EDT 1988
< root 20251 c Tue Aug 16 23:57:00 1988
> CMD: find /tmp ! -user root -atime +3 -exec rm {} \;
> root 20254 c Wed Aug 17 00:00:00 1988
> CMD: /usr/lib/sa/sa1 &
you don't have to put the date in there, i just find that it makes things
easier.
--
jfh at rpp386.uucp (The Beach Bum at The Big "D" Home for Wayward Hackers)
"Never attribute to malice what is adequately explained by stupidity"
-- Hanlon's Razor
More information about the Comp.unix.wizards
mailing list