Mercurial > hg > xemacs-beta
view lisp/w3/clean-cache @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | ac2d302a0011 |
children |
line wrap: on
line source
#!/bin/sh # # Copyright © 1995, William M. Perry <wmperry@spry.com> # # Author: William M. Perry <wmperry@spry.com> # Maintainer: William M. Perry <wmperry@spry.com> # Created: 95/04/18 10:44:15 # Version: $Revision: 1.1.1.1 $ # Modified: $Date: 1996/12/18 22:43:09 $ # Keywords: cache clean # # This shell script will clean out your cache directory for emacs-w3 # It is designed to be run from a cron (see crontab(5)) or at(1) # # This should probably only be run occasionally: like once a month, or # when you determine that the cache size is too big. Something like: # # CACHEMAXSIZE=5000 # SIZE=`du -s $CACHE_ROOT | awk '{print $1}' # if [ $SIZE -gt 5000 ] ; then # /run/the/real/clean-cache # fi if [ -z "$CACHE_ROOT" ] ; then CACHE_ROOT=/tmp/$USER # The root directory of the cache fi if [ -z "$CONTROL_FILE" ] ; then CONTROL_FILE="$CACHE_ROOT/.clean" fi if [ -z "$CLEAN_PROTOCOLS" ] ; then CLEAN_PROTOCOLS="http gopher file ftp wais news" fi if [ -f "$CONTROL_FILE" ] ; then echo "Starting to clean $CACHE_ROOT..." `date` for x in $CLEAN_PROTOCOLS do if [ -d "$x" ] ; then echo " Cleaning $x files" find $CACHE_ROOT/$x -depth -type f \( ! -anewer "$CONTROL_FILE" \) \ -exec rm -f {} \; find $CACHE_ROOT/$x -depth -type d -exec rmdir {} \; fi done touch "$CONTROL_FILE" echo "Cache clean ended: "`date` else echo "The cleaning control file ($CONTROL_FILE) could not be found." echo "To create it (and make all your cache files 'current' do:" echo "" echo "touch $CONTROL_FILE" echo "find $CACHE_ROOT -exec touch {} \;" echo "" echo "PLEASE NOTE: This can damage your cache, by changing the times it" echo "sends to the remote server to see if the file was modified." echo "I recommend just touching the file, then rerunning this script to" echo "wipe the cache clean and start over." fi