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

    Squid and SquidGuard crash problem when i use script

    General pfSense Questions
    2
    3
    1.8k
    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

      I prepared 1 script for squid cache clean, when i use this script on the command line it works very well.
      But when i add cron job this script squid and squidguard didnt work very well and system logs says you must use squid -z command and make squid cache. and i looked /var/squid/cache folder it is empty. How can i use with crontab this script. Thanks

      SquidCacheClean.sh

      #Created By Volkan Vural
      #This script using for Squid Cache Folder Cleaning for crontab
      #e-mail=aytvolkan@hotmail.com
      #Publish Date = 16.09.2011

      ps -f | grep "proxy_monitor.sh" | awk '{print $1}' | xargs kill -9
      /usr/local/etc/rc.d/squid.sh stop
      rm -rf /var/squid/cache/
      mkdir -p /var/squid/cache/
      chown proxy:proxy /var/squid/cache/
      chmod 777 /var/squid/cache/
      squid -z
      /usr/local/etc/rc.d/squid.sh start
      #Proxy Monitor Shell Starting
      nohup sh /usr/local/etc/rc.d/proxy_monitor.sh start &

      Volkan

      1 Reply Last reply Reply Quote 0
      • T
        Tikimotel
        last edited by

        Do you clean cache dir whilst squid/squidguard are active and running?
        I found after updating to "release", that squid / squidguard get restarted after a little while after you disable (stop) both using the web GUI.
        I needed to clean the cache by hand, but only had a brief moment to "rm -rf /var/squid/cache/" the cache directory before squid would become active again.
        I checked using "ps ax | grep squid" to see if squid was really inactive before the removal of the cache directory.
        In my case it would not remove the dir when squid was using it.

        Maybe in your case the dir is partly removed before squid auto restarts again or at least attempts to restart and fails in the process.
        You should pipe the output from the script commands to a log-file to see where it fails, at "rm" part or at "squid -z" part of the script.

        1 Reply Last reply Reply Quote 0
        • D
          dreamervlk
          last edited by

          Hi

          ps -f | grep "proxy_monitor.sh" | awk '{print $1}' | xargs kill -9

          This command is stopping autorestart squid and squidguard. i had tested.

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