This shell script will clean lighttpd web server cache. You need to run this script via a cron job. Download install script at /etc/cron.daily directory.
#!/bin/bash # Shell script to clean web server cache stored at /var/www/cache/ directory. # ------------------------------------------------------------------------- # Copyright (c) 2007 nixCraft project <http://cyberciti.biz/fb/> # This script is licensed under GNU GPL version 2.0 or above # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. # ------------------------------------------------------------------------- # Cache dir path CROOT="/var/www/cachelighttpd/" #Deleting files older than 10 days DAYS=10 # Lighttpd user and group LUSER="lighttpd" LGROUP="lighttpd" # start cleaning find ${CROOT} -type f -mtime +${DAYS} | xargs -r /bin/rm # if directory missing just recreate it if [ ! -d $CROOT ] then mkdir -p $CROOT chown ${LUSER}:${LGROUP} ${CROOT} fi
4000+ howtos and counting! If you enjoyed this article, join 45000+ others and get free email updates!
Click here to subscribe via email.
Click here to subscribe via email.
- Download Script
- Email this to a friend
- Rss Feed
- Last Updated: 04/28/08






