Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Auto Squid Cache Clean Script

    Scheduled Pinned Locked Moved pfSense Packages
    1 Posts 1 Posters 5.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      dreamervlk
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.