[nylug-talk] logrotate question
N.J. Thomas
njt at ayvali.org
Sat Feb 2 19:55:15 EST 2008
* Rodrick Brown <rodrick.brown at gmail.com> [2008-02-02 19:41:34-0500]:
> > Delete all files created more than 5 days ago?
> > $ find /path/to/logs -ctime +5 -type f -exec rm -f {} \;
>
> This is actually a much better approach than trying to just keep the
> last N files.
There is some safety built in when you delete only the last N files as
opposed to all files older than YYMMDD.
Suppose you are creating backups. And suppose that for whatever reason,
the process creating the backups fail.
If you are going by date, your deletion script doesn't "know" that new
backups are not being made, it merrily goes on and deletes all files
older than X days. If no one catches the fact that new backups are being
created, eventually, all your backups are deleted.
On the other hand, if you keep the last N files, you will have at least
those files available to you, no matter how long it takes before someone
realizes what is going on.
Thomas
--
N.J. Thomas
njt at ayvali.org
Etiamsi occiderit me, in ipso sperabo
More information about the nylug-talk
mailing list