Auto Squid Cache Clean Script



  • Hi Everyone,

    I made script for autoclean squid cache.

    First of all you have to create cleansquid.sh script under the  /sbin/ folder

    #cleansquid.sh
    #Created By Volkan Vural
    #This script using for Squid Cache Folder Cleaning
    #e-mail=aytvolkan@hotmail.com
    #Publish Date = 25.09.2012
    /usr/local/etc/rc.d/squid.sh 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/squid.sh start

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

    and we run the script and squid cache will be cleaned.
    ./cleansquid.sh

    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/cleansquid.sh

    http://www.volkanvural.name.tr/2011/05/pfsense-uzerinde-squid-cache-temizlemek.html

    Have Fun.
    Volkan Vural
    aytvolkan@hotmail.com


Log in to reply