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
Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our email newsletter to make sure you don't miss a single tip/tricks.
- Download Script
- Email this to a friend
- Rss Feed
- Last Updated: 04/28/08