View previous topic :: View next topic |
Author |
Message |
samureye n00b
Joined: 11 Jul 2002 Posts: 15
|
Posted: Thu Mar 13, 2003 3:11 am Post subject: program to clean up temporary dirs (/tmp /var/tmp) |
|
|
Hello,
I'm looking for a program (not fussy on what it's written in) that will clean out temporary directories/files, taking into consideration the file/directories'
age (atime, ctime or mtime)
type of file (socket, file, directory, symlink)
if the file is in use
if the files' uid does not resolve
if the file is a symlink, is it 'dangling'
Does anyone know of any programs out there that would achieve this?! If not, I might have to write my own!
Thanks |
|
Back to top |
|
|
Chris W l33t
Joined: 25 Jun 2002 Posts: 972 Location: Brisbane, Australia
|
Posted: Thu Mar 13, 2003 5:18 am Post subject: |
|
|
Write an rc or cron script built around what you find here:
Code: |
$ man find
$ man xargs
|
For example:
Code: |
find /tmp -type f -mtime +7 | xargs rm
|
_________________ Cheers,
Chris W
"Common sense: The collection of prejudices acquired by age 18." -- Einstein |
|
Back to top |
|
|
samureye n00b
Joined: 11 Jul 2002 Posts: 15
|
Posted: Thu Mar 13, 2003 5:56 am Post subject: |
|
|
Thanks Chris.
I was hoping there was some programs already out there that do the trick. I have a perl script that does the job.. just wanted to know if there is something out there that is better.
Chris W wrote: | Write an rc or cron script built around what you find here:
Code: |
$ man find
$ man xargs
|
For example:
Code: |
find /tmp -type f -mtime +7 | xargs rm
|
|
|
|
Back to top |
|
|
ozric100 Tux's lil' helper
Joined: 23 Apr 2002 Posts: 136
|
Posted: Thu Mar 13, 2003 8:34 pm Post subject: |
|
|
emerge -s tmpwatch
I don't know if its still masked.(at work XP-pro.. barf). I cron it everyday or so. Its been fine for me. |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20067
|
|
Back to top |
|
|
samureye n00b
Joined: 11 Jul 2002 Posts: 15
|
Posted: Thu Mar 13, 2003 10:52 pm Post subject: |
|
|
Thanks for the assistance guys |
|
Back to top |
|
|
|