Amos Shapira wrote:
Upon re-reading the question, I just realised that you create the file
hourly from cron. You can then either follow Steffens' advise or run
"savelog" or your own mv (since Savelog is limited in its file naming
options) at the end of the cron job.

On 1/13/10, Steffen Schulz <pepe...@gmx.net> wrote:
On 100112 at 16:09, david wrote:
Is there a good reason NOT to rotate logs hourly.. for example by
moving the logrotate cron to hourly instead of daily? This is a file
created hourly by cron for which I want to keep a history.

Maybe you rather want to include the date in the file name, so it is
not overwritten. E.g., for an arbitrary cronjob named foobar:

foobar > /var/log/foobar.log.$(date +%w) 2>&1

This will keep the 6 last files. You get the idea.

logrotate looks like a good way to do it. I'm assuming there is no
"hourly" option in logrotate, so I was going to force it to rotate
by specifying a very small file size.
If you do the above, logrotate should ignore the file.



Ultimately I realised I was being too complicated.

I added the following line to the cron job that creates the file. Each file is uniquely named with a date stamp as part of the cron script. This line should keep one week's worth of files.

find $DIRECTORY/ -name "*.tar" -type f -mmin +10080 -delete

thanks everyone...

David.
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to