aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2013-01-06 19:18:19 -0800
committerChris Buechler <cmb@pfsense.org>2013-01-06 19:18:19 -0800
commitff8b5325d6c7c97364a6d549871a815445497b70 (patch)
tree0c079943fd86ccfd90ca41160c742abd05bd56ea
parente1bea5a33c2eaab8a35c9ee802bf0f19c869c12a (diff)
parent13b74f83284009f127d0d95ad84babf21a660f07 (diff)
downloadpfsense-packages-ff8b5325d6c7c97364a6d549871a815445497b70.tar.gz
pfsense-packages-ff8b5325d6c7c97364a6d549871a815445497b70.tar.bz2
pfsense-packages-ff8b5325d6c7c97364a6d549871a815445497b70.zip
Merge pull request #347 from phil-davis/master
Replace proxy_monitor with sqpmon for squid3
-rw-r--r--config/squid-reverse/proxy_monitor.sh76
-rw-r--r--config/squid-reverse/sqpmon.sh75
-rw-r--r--config/squid-reverse/squid.inc14
-rw-r--r--config/squid-reverse/squid.xml6
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
6 files changed, 89 insertions, 86 deletions
diff --git a/config/squid-reverse/proxy_monitor.sh b/config/squid-reverse/proxy_monitor.sh
index 17de3997..e69de29b 100644
--- a/config/squid-reverse/proxy_monitor.sh
+++ b/config/squid-reverse/proxy_monitor.sh
@@ -1,76 +0,0 @@
-#!/bin/sh
-# $Id$ */
-#
-# proxy_monitor.sh
-# Copyright (C) 2006 Scott Ullrich
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1. Redistributions of source code must retain the above copyright notice,
-# this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-if [ `pgrep -f "proxy_monitor.sh"|wc -l` -ge 1 ]; then
- exit 0
-fi
-
-set -e
-
-LOOP_SLEEP=55
-
-if [ -f /var/run/squid_alarm ]; then
- rm /var/run/squid_alarm
-fi
-
-# Sleep 5 seconds on startup not to mangle with existing boot scripts.
-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
-done
-
-if [ -f /var/run/squid_alarm ]; then
- rm /var/run/squid_alarm
-fi
-
diff --git a/config/squid-reverse/sqpmon.sh b/config/squid-reverse/sqpmon.sh
new file mode 100644
index 00000000..244b3b61
--- /dev/null
+++ b/config/squid-reverse/sqpmon.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+# $Id$ */
+#
+# sqpmon.sh
+# Copyright (C) 2006 Scott Ullrich
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if [ `pgrep -f "sqpmon.sh"|wc -l` -ge 1 ]; then
+ exit 0
+fi
+
+set -e
+
+LOOP_SLEEP=55
+
+if [ -f /var/run/squid_alarm ]; then
+ rm /var/run/squid_alarm
+fi
+
+# Sleep 5 seconds on startup not to mangle with existing boot scripts.
+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
+done
+
+if [ -f /var/run/squid_alarm ]; then
+ rm /var/run/squid_alarm
+fi
diff --git a/config/squid-reverse/squid.inc b/config/squid-reverse/squid.inc
index 4212861e..941395f6 100644
--- a/config/squid-reverse/squid.inc
+++ b/config/squid-reverse/squid.inc
@@ -282,6 +282,10 @@ function squid_install_command() {
squid_write_rcfile();
if(file_exists("/usr/local/pkg/swapstate_check.php"))
exec("/bin/chmod a+x /usr/local/pkg/swapstate_check.php");
+ write_rcfile(array(
+ "file" => "sqp_monitor.sh",
+ "start" => "/usr/local/pkg/sqpmon.sh &",
+ "stop" => "ps awux | grep \"sqpmon\" | grep -v \"grep\" | grep -v \"php\" | awk '{ print $2 }' | xargs kill"));
foreach (array( SQUID_CONFBASE,
SQUID_ACLDIR,
@@ -295,7 +299,7 @@ function squid_install_command() {
/* kill any running proxy alarm scripts */
update_status("Checking for running processes... One moment please...");
log_error("Stopping any running proxy monitors");
- mwexec("ps awux | grep \"proxy_monitor\" | grep -v \"grep\" | grep -v \"php\" | awk '{ print $2 }' | xargs kill");
+ mwexec("/usr/local/etc/rc.d/sqp_monitor.sh stop");
sleep(1);
if (!file_exists(SQUID_CONFBASE . '/mime.conf') && file_exists(SQUID_CONFBASE . '/mime.conf.default'))
@@ -316,7 +320,7 @@ function squid_install_command() {
/* restart proxy alarm scripts */
log_error("Starting a proxy monitor script");
- mwexec_bg("/usr/local/etc/rc.d/proxy_monitor.sh");
+ mwexec_bg("/usr/local/etc/rc.d/sqp_monitor.sh start");
update_status("Reconfiguring filter... One moment please...");
filter_configure();
@@ -337,8 +341,8 @@ function squid_deinstall_command() {
mwexec('rm -rf $cachedir/swap.state');
mwexec('rm -rf $logdir');
update_status("Finishing package cleanup.");
- mwexec('rm -f /usr/local/etc/rc.d/proxy_monitor.sh');
- mwexec("ps awux | grep \"proxy_monitor\" | grep -v \"grep\" | grep -v \"php\" | awk '{ print $2 }' | xargs kill");
+ mwexec("/usr/local/etc/rc.d/sqp_monitor.sh stop");
+ mwexec('rm -f /usr/local/etc/rc.d/sqp_monitor.sh');
mwexec("ps awux | grep \"squid\" | grep -v \"grep\" | awk '{ print $2 }' | xargs kill");
mwexec("ps awux | grep \"dnsserver\" | grep -v \"grep\" | awk '{ print $2 }' | xargs kill");
mwexec("ps awux | grep \"unlinkd\" | grep -v \"grep\" | awk '{ print $2 }' | xargs kill");
@@ -1935,4 +1939,4 @@ function squid_do_xmlrpc_sync($sync_to_ip, $username, $password) {
}
-?> \ No newline at end of file
+?>
diff --git a/config/squid-reverse/squid.xml b/config/squid-reverse/squid.xml
index 943f3ed5..72c10ab6 100644
--- a/config/squid-reverse/squid.xml
+++ b/config/squid-reverse/squid.xml
@@ -189,9 +189,9 @@
<item>http://www.pfsense.org/packages/config/squid-reverse/squid_users.xml</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/usr/local/etc/rc.d/</prefix>
+ <prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
- <item>http://www.pfsense.org/packages/config/squid-reverse/proxy_monitor.sh</item>
+ <item>http://www.pfsense.org/packages/config/squid-reverse/sqpmon.sh</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
@@ -448,4 +448,4 @@
exec("/bin/rm -f /usr/local/etc/rc.d/squid*");
</custom_php_deinstall_command>
<filter_rules_needed>squid_generate_rules</filter_rules_needed>
-</packagegui> \ No newline at end of file
+</packagegui>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index 0138f28e..c6e18d0e 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -1241,7 +1241,7 @@
<pkginfolink>http://forum.pfsense.org/index.php/topic,48347.0.html</pkginfolink>
<website>http://www.squid-cache.org/</website>
<category>Network</category>
- <version>3.1.20 pkg 2.0.5_7</version>
+ <version>3.1.20 pkg 2.0.5_8</version>
<status>beta</status>
<required_version>2.0</required_version>
<maintainer>marcellocoutinho@gmail.com fernando@netfilter.com.br seth.mos@dds.nl mfuchs77@googlemail.com jimp@pfsense.org</maintainer>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index d3264c2b..65b58a1f 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -1228,7 +1228,7 @@
<pkginfolink>http://forum.pfsense.org/index.php/topic,48347.0.html</pkginfolink>
<website>http://www.squid-cache.org/</website>
<category>Network</category>
- <version>3.1.20 pkg 2.0.5_7</version>
+ <version>3.1.20 pkg 2.0.5_8</version>
<status>beta</status>
<required_version>2.0</required_version>
<maintainer>marcellocoutinho@gmail.com fernando@netfilter.com.br seth.mos@dds.nl mfuchs77@googlemail.com jimp@pfsense.org</maintainer>