[Techtalk] procmail log rotation

Charlotte Oliver aeris at nevvers.net
Tue Jul 1 12:54:35 EST 2003


On Tue, Jul 01, 2003 at 12:31:25PM -0400, Emma Jane Hogbin wrote:
> Does anyone have a simple log rotation script for procmail logs? I'd like
> to rotate the logs once a week and keep two weeks worth of logs (current +
> 1 week old + 2 weeks old). I've tried working on this before, but whenever
> I remove the log file by hand Procmail stops logging output to a file...
> 
> Thanks!
> 
> emma

I don't have one, as I don't run procmail, but you could probably write
a shell script fairly easily.  To get around Procmail ceasing to log output,
you could try something like this:

cp logfile logfile.%d%b%Y   		//copy the logfile, with a date.
touch blank											//create a blank file
mv blank logfile								//copies a blank file into space where
																//the original logfile was, thus making
																//the original logfile blank.

That said, I don't run Procmail, so I don't really know what I'm talking
about.  That might give you problems too.  

This is just similiar to other log rotation scripts I've written.  I 
would then run the script once a week via cron.  You could also add 
in fancy stuff to delete old logs if you wanted.  

Charlotte


More information about the Techtalk mailing list