aboutsummaryrefslogtreecommitdiffstats
path: root/config/squid3/34/sqpmon.sh
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-09-24 16:11:21 +0200
committerdoktornotor <notordoktor@gmail.com>2015-09-24 16:11:21 +0200
commite1737f4747d8fb25df6d7c977421de792999fbf3 (patch)
tree7bf414b8f87983f5d147d2f8577cc40cd2e42da6 /config/squid3/34/sqpmon.sh
parent14b08ca6206352556a62efe10326a1f7b5cd3f49 (diff)
downloadpfsense-packages-e1737f4747d8fb25df6d7c977421de792999fbf3.tar.gz
pfsense-packages-e1737f4747d8fb25df6d7c977421de792999fbf3.tar.bz2
pfsense-packages-e1737f4747d8fb25df6d7c977421de792999fbf3.zip
squid3 - code style fixes
Diffstat (limited to 'config/squid3/34/sqpmon.sh')
-rw-r--r--config/squid3/34/sqpmon.sh62
1 files changed, 32 insertions, 30 deletions
diff --git a/config/squid3/34/sqpmon.sh b/config/squid3/34/sqpmon.sh
index 244b3b61..48854565 100644
--- a/config/squid3/34/sqpmon.sh
+++ b/config/squid3/34/sqpmon.sh
@@ -1,8 +1,10 @@
#!/bin/sh
# $Id$ */
#
-# sqpmon.sh
-# Copyright (C) 2006 Scott Ullrich
+# sqpmon.sh
+# part of pfSense (https://www.pfSense.org/)
+# Copyright (C) 2006 Scott Ullrich
+# Copyright (C) 2015 ESF, LLC
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -27,8 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-if [ `pgrep -f "sqpmon.sh"|wc -l` -ge 1 ]; then
- exit 0
+if [ `/bin/pgrep -f "sqpmon.sh" | /usr/bin/wc -l` -ge 1 ]; then
+ exit 0
fi
set -e
@@ -36,7 +38,7 @@ set -e
LOOP_SLEEP=55
if [ -f /var/run/squid_alarm ]; then
- rm /var/run/squid_alarm
+ /bin/rm -f /var/run/squid_alarm
fi
# Sleep 5 seconds on startup not to mangle with existing boot scripts.
@@ -44,32 +46,32 @@ sleep 5
# Squid monitor 1.2
while [ /bin/true ]; do
- if [ ! -f /var/run/squid_alarm ]; then
- NUM_PROCS=`ps auxw | grep "[s]quid -f"|awk '{print $2}'| wc -l | awk '{ print $1 }'`
- if [ $NUM_PROCS -lt 1 ]; then
- # squid is down
- echo "Squid has exited. Reconfiguring filter." | \
- logger -p daemon.info -i -t Squid_Alarm
- echo "Attempting restart..." | logger -p daemon.info -i -t Squid_Alarm
- /usr/local/etc/rc.d/squid.sh start
- sleep 3
- echo "Reconfiguring filter..." | logger -p daemon.info -i -t Squid_Alarm
- /etc/rc.filter_configure
- touch /var/run/squid_alarm
- fi
- fi
- NUM_PROCS=`ps auxw | grep "[s]quid -f"|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
- rm /var/run/squid_alarm
- fi
- fi
- sleep $LOOP_SLEEP
+ if [ ! -f /var/run/squid_alarm ]; then
+ NUM_PROCS=`/bin/ps auxw | /usr/bin/grep "[s]quid -f" | /usr/bin/awk '{print $2}' | /usr/bin/wc -l | /usr/bin/awk '{ print $1 }'`
+ if [ $NUM_PROCS -lt 1 ]; then
+ # squid is down
+ echo "Squid has exited. Reconfiguring filter." | \
+ /usr/bin/logger -p daemon.info -i -t Squid_Alarm
+ echo "Attempting restart..." | /usr/bin/logger -p daemon.info -i -t Squid_Alarm
+ /usr/local/etc/rc.d/squid.sh start
+ sleep 3
+ echo "Reconfiguring filter..." | /usr/bin/logger -p daemon.info -i -t Squid_Alarm
+ /etc/rc.filter_configure
+ touch /var/run/squid_alarm
+ fi
+ fi
+ NUM_PROCS=`/bin/ps auxw | /usr/bin/grep "[s]quid -f" | /usr/bin/awk '{print $2}' | /usr/bin/wc -l | /usr/bin/awk '{ print $1 }'`
+ if [ $NUM_PROCS -gt 0 ]; then
+ if [ -f /var/run/squid_alarm ]; then
+ echo "Squid has resumed. Reconfiguring filter." | \
+ /usr/bin/logger -p daemon.info -i -t Squid_Alarm
+ /etc/rc.filter_configure
+ /bin/rm -f /var/run/squid_alarm
+ fi
+ fi
+ sleep $LOOP_SLEEP
done
if [ -f /var/run/squid_alarm ]; then
- rm /var/run/squid_alarm
+ /bin/rm -f /var/run/squid_alarm
fi