Re: cron logging

Martin Schulze (joey@finlandia.infodrom.north.de)
Fri, 4 Jul 1997 23:31:10 +0200


Randal Koene writes:

> This might be a wee-bit off kernel topic, but not entirely. I'm running a
> number of periodic tests on a minimal installation of the 2.0.30 kernel
> (mainly w.r.t. the kerneld), and use cron to do so. I need to keep a cron
> log in /var/log/cron, but only for a short while. So logging has to be
> on, but I would like to clear the log automatically every once in a while
> -- or even better yet just clear the oldest couple'a thousand entries. I
> was thinking of letting cron schedule that update (e.g. rm the file or
> some such thing). Will this cause problems? It seems that cron never
> closes and reopens the filehandle, as renaming the file has no effect and
> logging continues on the renamed file. So would for instance erasing the
> log and creating a new one totally confuse cron?

If you rm the file (your unlinking the inode if I'm not mistaken) but
don't tell syslogd to re-open the logfile (by sending SIGHUP to it)
syslogd will still log to the unlinked file - which still exists on
your hard drive.

You can set the length of the logfile to zero every once in a while
without running into trouble. Just do a 'echo -n > /var/log/cron'.

Regards

Joey

-- 
  / Martin Schulze  *  joey@infodrom.north.de  *  26129 Oldenburg /
 /                                     http://home.pages.de/~joey/
/ Kernel-Patching in DOS? Selten so gelacht!   -- Jochen Schoof /