I was very low on disk space and netscape kept eating it all up--mine
would delete the cache, but wouldn't limit it at all.  So I wrote a
script to search the /home directory structure and remove the caches
if they were greater than 1M.  Whenever it removes one, it writes a
message to a log file in /var/log.  Then I simply but a link to this
script in /etc/cron.daily.

Here's the script.  Please look over it to make sure it will do what
you want (before you run it): it assumes that your user's home
directories are in /home.

--------rmcache.sh------------
#!/bin/bash

# usage: rmcache.sh

# This script searches the /home directory structure for .netscape/cache
# directories.  If any cache directory is larger than $MAX_CACHE_SIZE,
# the directory will be removed

MAX_CACHE_SIZE=1000     # Maximum allowable cache size in kilobytes
DATE=$(date '+%b %d %r')
LOGFILE="/var/log/rmcache"

total=0
for dir in $(ls /home); do
        if [ -d /home/$dir/.netscape/cache ]; then
                curSize=$(du -sk /home/$dir/.netscape/cache)
                # Strip the numeric part from curSize
                curSize=$(expr "$curSize" : '\([0-9]*\)')
                if [ $curSize -gt $MAX_CACHE_SIZE ]; then
                        echo "/home/$dir/.netscape/cache is ${curSize}K...removing"
                        #if [ "$1" = "-s" ]; then
                                rm -rf /home/$dir/.netscape/cache/*
                                # Write to log file $LOGFILE
                                echo "$DATE : removed /home/$dir/.netscape/cache 
(${curSize}K)" >> $LOGFILE
                        #fi
                fi
        fi
done
----------end-------------



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to