Auto Squid Cache Clean Script

  • Hi Everyone,

    I made script for autoclean squid cache.

    First of all you have to create script under the  /sbin/ folder
    #Created By Volkan Vural
    #This script using for Squid Cache Folder Cleaning
    #Publish Date = 25.09.2012
    /usr/local/etc/rc.d/ stop
    rm -rf /var/squid/cache/
    mkdir -p /var/squid/cache/
    cd /var/squid/
    chown proxy:proxy cache
    chmod 755 /var/squid/cache/
    squid -z
    /usr/local/etc/rc.d/ start

    Save. And write below command, ( it gives permission execute to script file)
    chmod 777  /sbin/

    and we run the script and squid cache will be cleaned.

    if you want this script runs automatically, you can use crontab.
    Example : Every months  1. day,  time 23:30 , script will be cleaning auto squid cache directory.
    crontab -e
    30 23 1 * * /bin/sh /sbin/

    Have Fun.
    Volkan Vural

Log in to reply