Mercurial > hg > xemacs-beta
comparison lisp/w3/clean-cache @ 2:ac2d302a0011 r19-15b2
Import from CVS: tag r19-15b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:46:35 +0200 |
parents | |
children | 131b0175ea99 |
comparison
equal
deleted
inserted
replaced
1:c0c6a60d29db | 2:ac2d302a0011 |
---|---|
1 #!/bin/sh | |
2 # | |
3 # Copyright © 1995, William M. Perry <wmperry@spry.com> | |
4 # | |
5 # Author: William M. Perry <wmperry@spry.com> | |
6 # Maintainer: William M. Perry <wmperry@spry.com> | |
7 # Created: 95/04/18 10:44:15 | |
8 # Version: $Revision: 1.1.1.1 $ | |
9 # Modified: $Date: 1996/12/18 03:46:20 $ | |
10 # Keywords: cache clean | |
11 # | |
12 # This shell script will clean out your cache directory for emacs-w3 | |
13 # It is designed to be run from a cron (see crontab(5)) or at(1) | |
14 # | |
15 # This should probably only be run occasionally: like once a month, or | |
16 # when you determine that the cache size is too big. Something like: | |
17 # | |
18 # CACHEMAXSIZE=5000 | |
19 # SIZE=`du -s $CACHE_ROOT | awk '{print $1}' | |
20 # if [ $SIZE -gt 5000 ] ; then | |
21 # /run/the/real/clean-cache | |
22 # fi | |
23 | |
24 if [ -z "$CACHE_ROOT" ] ; then | |
25 CACHE_ROOT=/tmp/$USER # The root directory of the cache | |
26 fi | |
27 | |
28 if [ -z "$CONTROL_FILE" ] ; then | |
29 CONTROL_FILE="$CACHE_ROOT/.clean" | |
30 fi | |
31 | |
32 if [ -z "$CLEAN_PROTOCOLS" ] ; then | |
33 CLEAN_PROTOCOLS="http gopher file ftp wais news" | |
34 fi | |
35 | |
36 if [ -f "$CONTROL_FILE" ] ; then | |
37 echo "Starting to clean $CACHE_ROOT..." `date` | |
38 | |
39 for x in $CLEAN_PROTOCOLS | |
40 do | |
41 if [ -d "$x" ] ; then | |
42 echo " Cleaning $x files" | |
43 find $CACHE_ROOT/$x -depth -type f \( ! -anewer "$CONTROL_FILE" \) \ | |
44 -exec rm -f {} \; | |
45 find $CACHE_ROOT/$x -depth -type d -exec rmdir {} \; | |
46 fi | |
47 done | |
48 | |
49 touch "$CONTROL_FILE" | |
50 echo "Cache clean ended: "`date` | |
51 else | |
52 echo "The cleaning control file ($CONTROL_FILE) could not be found." | |
53 echo "To create it (and make all your cache files 'current' do:" | |
54 echo "" | |
55 echo "touch $CONTROL_FILE" | |
56 echo "find $CACHE_ROOT -exec touch {} \;" | |
57 echo "" | |
58 echo "PLEASE NOTE: This can damage your cache, by changing the times it" | |
59 echo "sends to the remote server to see if the file was modified." | |
60 echo "I recommend just touching the file, then rerunning this script to" | |
61 echo "wipe the cache clean and start over." | |
62 fi |