Logrotating single-issue files

Jos Vos jos at xos.nl
Mon Nov 10 11:50:59 UTC 2003


On Mon, Nov 10, 2003 at 12:12:48PM +0100, Nicolas Mailhot wrote:

> 	The problem is of course once the files have been rotated once nothing
> will recreate the original files so they'll be stuck in first rotation
> forever (of course one might tell logrotate to create empty new files
> after compression but that means filling the disk with empty files -
> plus gziped empty files are *not* zero-sized anymore).

Well, yes, but at first sight creating new empty files seems to be
the best solution.  Furthermore, IIRC you can define a shell script
as "compresscmd" in your logrotate config, that could be like this
(all untested, RTFM, I don't know the exact interface):

	if [ -s $1 ]; then
		gzip $1
	else
		mv $1 $1.gz
	fi

Cheers,

-- 
--    Jos Vos <jos at xos.nl>
--    X/OS Experts in Open Systems BV   |   Phone: +31 20 6938364
--    Amsterdam, The Netherlands        |     Fax: +31 20 6948204





More information about the fedora-devel-list mailing list