Many proxy_monitor.sh started from squid.



  • It looks like every time the squid service is restarted another prooxy_monitor.sh is started. This includes IP address changes (or detected change from a PPPoE reconnect). This is wasting my CPU and memory, not to mention that each time this happens, each script that is running reloads my filter.



  • Can we just add

    
    IS_RUNNING=`ps awx |grep -c "[p]roxy_monitor.sh"`
    if [ $IS_RUNNING -gt 0 ]; then
            exit 0
    fi
    
    

    Just under the comments and above "set -e" so that if proxy_monitor.sh is already running, we don't start is again and again and again …

    Please?

    Edit: I sent a pull request for this file change. Please review and commit if that works for you guys.



  • @podilarius:

    Edit: I sent a pull request for this file change. Please review and commit if that works for you guys.

    Merged. Thanks for your feedback.



  • Pasted the wrong if comparison. Submitted pull request to fix that. Sorry about that.



  • Just posted another pull request. Sorry about that, it was working until reboot. For some reason (beyond my understanding) when the script starts and I see how many proxy_monitor.sh scripts are running, it shows 2. If I see what is there manually a sec later, it shows 1. Since the variable is already loaded with 2, the script exits out. It might have something to do with the way it is being called from squid reload/load with the mwexec_bg. I am not sure on that entirely though.

    I modified the code to match the way the script is being called. The result is  only one infinite loop running in the background.


Log in to reply