Re: [expert] Clean up old logs (more specific)

2003-11-19 Thread John Coates
 
 When I tried doing the line you defined above, I get this output:
 
 find: paths must precede expression
 Usage: find [path...] [expression]
 rm: too few arguments
 Try `rm --help' for more information.
 
 So I did it this way:
 
 find /var/log -type f -mtime 5 | xargs rm
 
 And it works.  The only thing that catches my attention is that in the
 'find' man page, '-mtime' says:
 
  -mtime n
   File's data was last modified n*24 hours ago.
 
 This would seem to me to mean a static multiplyer.  In other words,
 '-mtime 30' would be any logs created exactly 30 days ago - not 31, not
 29.
 
 How would you state 'anything over 30 days'?  And why did you create the
 syntax the way you did above; with the '.' after 'find' and the order of
 commands?
 
 Thanks!
 

find /var/log -type f -mtime +30

will find any file in the /var/log directory that is more than 30 days
old.  Find expects one argument which is a path to a directory to start
the search (which can be /var/log or . if your cwd is /var/log), then
there are tons of possible arguments.  The path must be given first, but
the arguments can usually be given in any order (unless you get fancy).

John

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com


Re: [expert] Clean up old logs (more specific)

2003-11-16 Thread Michael Holt
On Sat, 2003-11-15 at 08:34, David E. Fox wrote:
  My firewall has been up and running for the last 2 years now. While trying =
  to cleanup the partitions I noticed a wholalotta log files from various stu=
 
 Please don't post HTML.
 
 Adrian, isn't logrotate working? Or do you want to clean the stuff up 
 now? At any rate, find would do the job:
 
 # find . -type f /var/log -mtime 30 | xargs rm
 
 That gets rid of files modified over 30 days ago.

When I tried doing the line you defined above, I get this output:

find: paths must precede expression
Usage: find [path...] [expression]
rm: too few arguments
Try `rm --help' for more information.

So I did it this way:

find /var/log -type f -mtime 5 | xargs rm

And it works.  The only thing that catches my attention is that in the
'find' man page, '-mtime' says:

 -mtime n
  File's data was last modified n*24 hours ago.

This would seem to me to mean a static multiplyer.  In other words,
'-mtime 30' would be any logs created exactly 30 days ago - not 31, not
29.

How would you state 'anything over 30 days'?  And why did you create the
syntax the way you did above; with the '.' after 'find' and the order of
commands?

Thanks!


-- 
Michael Holt
Snohomish, WA   (o_
[EMAIL PROTECTED] (o_  (o_  //\
www.holt-tech.net (/)_ (/)_ V_/_ www.mandrakelinux.com 
==
81. The drive ate the tape but that's OK, I brought my screwdriver.

--Top 100 things you don't want the sysadmin to say


Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com