Proxy_monitor.sh fixed
-
I'm always monitoring squid. proxy_monitor.sh doesn't work as expected. so I've modified some. now its final.
#!/bin/sh set -e LOOP_SLEEP=10 sleep 5 while [ /bin/true ] ; do if [ ! -f /var/run/squid_alarm ]; then NUM_PROCS=`ps auxw | grep "(squid) -D" | grep -v grep |awk '{print $2}'| wc -l | awk '{ print $1 }'` if [ $NUM_PROCS -lt 1 ]; then echo "Squid has exited. Reconfiguring filter." | \ logger -p daemon.info -i -t Squid_Alarm /etc/rc.filter_configure_sync echo "Attempting restart..." | logger -p daemon.info -i -t Squid_Alarm /usr/local/etc/rc.d/squid.sh start #if error squid will retry 5 times for about 13secs trying to run squid child process so wait 15secs. sleep 15 touch /var/run/squid_alarm fi fi NUM_PROCS=`ps auxw | grep "(squid) -D"| grep -v grep |awk '{print $2}'| wc -l | awk '{ print $1 }'` if [ $NUM_PROCS -gt 0 ]; then if [ -f /var/run/squid_alarm ]; then echo "Squid has resumed. Reconfiguring filter." | \ logger -p daemon.info -i -t Squid_Alarm /etc/rc.filter_configure_sync rm /var/run/squid_alarm fi fi sleep $LOOP_SLEEP doneservice-utils.inc sees anything squid from process as service even```
tail -f /var/squid/log/cache.logThis is why /etc/rc.filter_configure_sync won't remove redirect from pf nat :( so be careful when debugging squid ;) To fix that.Modify squid.inc to double check if squid -D is running(squid name in path. services detects squid is running)$squid_conf = $config['installedpackages']['squid']['config'][0]; if ((!is_service_running('squid')) || (!is_process_running('squid -D'))){ log_error("SQUID is installed but not started. Not installing redirect rules."); return; }but there's always a better way than proxy_monitor.sh which will exactly run script when squid dies or shutdown. -
It works, and in this situation has the identical meaning.
-
may i know … what this goal ? btw, i would like to try it soon :)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginPrivacy Policy · Cookie Policy