Remove the Squid Proxy Server Cache Manually / Automatically

If you want to delete an object in the Squid proxy server cache, all you can do is manually and automatically delete the Squid proxy cache, here we will discuss how to maintain our proxy machine, the following methods can be run manually or automatically in removing the cache your squid proxy.

Manually delete the squid proxy cache;
1. Stop/stop the running Squid process


2. Clean all of Squid’s swap directory cache

3. Make / re-install the Squid cache swap directory


4. Run the squid proxy server again


Automatically delete the Squid proxy cache

If you want to delete the squid proxy cache automatically, the following steps:
1. Create a script that will be used to automatically check and delete the squid proxy cache


Enter the following code, where in the following code setting the Squid proxy hard drive is 80GB, the squid cache directory is in / cache and the script will be placed on / root

Give access rights so that the clear-cache-squid.sh script can be run


After you have created the file, it is time to put it on your cronjob system, so that the script can run automatically every day at midnight.

Edit cronjob


Enter the following cronjob code


To more easily convert the amount of GB to KB or vice versa you can use website services including KB, MB, GB Converter, squid clear cache script that you can.