Joined: 22 Oct 2004
|Posted: Tue Dec 07, 2004 8:31 am Post subject: quick tip: keeping temp files under control
|just a quick little tip. i use a util called "tmpwatch" to keep a few of my temp/cache/distfiles dirs under control. just 'emerge tmpwatch'. it will recursively search a directory and delete any files older than how many hours you specify. it can also check if the file is in use first using fuser. by default it uses access times to check, so if you have your partitions mounted "noatime", be sure to either remount them without that option or use the -m (modified time) option with tmpwatch.
here's a ghetto script.
tmpwatch -vs 168 /tmp
tmpwatch -vs 168 /var/log/portage
tmpwatch -vs 168 /var/tmp/portage
tmpwatch -mvs 168 /usr/portage/distfiles
this deletes any temp files i have if nothing has touched them in a week.
note: don't use the -m option on /var/tmp/portage. since the files that are extracted there keep their original time stamps, the modified date will almost always be older than one week, and the script will delete them, even if you've just extracted them and even if you're in the middle of an emerge.