Introduction
LiteSpeed doesn't automatically clear the VirtualHost-level cache. However, this cache can be cleared with a cron job. This article provides the steps to create the cron job.
Procedure
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Open
crontab
in editor mode.crontab -e
- Press the
o
key to enter insert mode on a new line. - Enter the following article.
0 0 * * * LARGE_LSDIR="$(du --threshold=30G -sh /home/*/lscache/ | cut -f2-)"; for ls_path in $LARGE_LSDIR; do echo "Clean up $ls_path"; find $ls_path -type f -mtime +1440 -exec rm -f {} \;; done
- Press the
esc
key to exit insert mode. - Enter
:wq
and hit theenter
key to save the changes and exitcrontab
.