aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/unbound/unbound.inc7
-rw-r--r--config/unbound/unbound.xml4
-rwxr-xr-xconfig/unbound/unbound_monitor.sh27
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
5 files changed, 29 insertions, 13 deletions
diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc
index 3287b194..c5cbfc49 100644
--- a/config/unbound/unbound.inc
+++ b/config/unbound/unbound.inc
@@ -70,6 +70,7 @@ function unbound_initial_setup() {
// We do not need the sample conf or the default rc.d startup file
@unlink_if_exists(UNBOUND_BASE . "/etc/unbound/unbound.conf.sample");
@unlink_if_exists(UNBOUND_BASE . "/etc/rc.d/unbound");
+ @unlink_if_exists("/usr/local/etc/rc.d/unbound");
// Setup rc file for startup and shutdown.
unbound_rc_setup();
@@ -205,7 +206,7 @@ function unbound_control($action) {
@unlink("/var/run/dnsmasq.pid");
mwexec("/bin/ln -s /var/run/unbound.pid /var/run/dnsmasq.pid");
}
- mwexec_bg("/usr/local/etc/rc.d/unbound_monitor.sh start");
+ mwexec_bg("/usr/local/bin/unbound_monitor.sh");
fetch_root_hints();
}
break;
@@ -213,14 +214,14 @@ function unbound_control($action) {
case "stop":
//Stop unbound and unmount the file system
if($unbound_config['unbound_status'] == "on") {
- mwexec_bg("/usr/local/etc/rc.d/unbound_monitor.sh stop");
+ mwexec_bg("/usr/local/bin/unbound_monitor.sh stop");
unbound_ctl_exec("stop");
}
break;
case "termstop":
//Stop Unbound by sigkillbypid();
- mwexec_bg("/usr/local/etc/rc.d/unbound_monitor.sh stop");
+ mwexec_bg("/usr/local/bin/unbound_monitor.sh stop");
sigkillbypid("{$g['varrun_path']}/unbound.pid", "TERM");
break;
diff --git a/config/unbound/unbound.xml b/config/unbound/unbound.xml
index 36c005a4..10de1f97 100644
--- a/config/unbound/unbound.xml
+++ b/config/unbound/unbound.xml
@@ -40,7 +40,7 @@
<requirements/>
<faq/>
<name>unbound</name>
- <version>1.4.20_4</version>
+ <version>1.4.20_5</version>
<title>Services: Unbound DNS Forwarder: Basic Settings</title>
<include_file>/usr/local/pkg/unbound.inc</include_file>
<menu>
@@ -76,7 +76,7 @@
<item>http://www.pfsense.org/packages/config/unbound/unbound_advanced.xml</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/usr/local/etc/rc.d/</prefix>
+ <prefix>/usr/local/bin/</prefix>
<chmod>0755</chmod>
<item>http://www.pfsense.org/packages/config/unbound/unbound_monitor.sh</item>
</additional_files_needed>
diff --git a/config/unbound/unbound_monitor.sh b/config/unbound/unbound_monitor.sh
index 042866be..c277bbaa 100755
--- a/config/unbound/unbound_monitor.sh
+++ b/config/unbound/unbound_monitor.sh
@@ -27,33 +27,48 @@
# POSSIBILITY OF SUCH DAMAGE.
#
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
+
set -e
LOOP_SLEEP=5
+PIDFILE=/var/run/unbound_monitor.pid
if [ -f /var/run/unbound_alarm ]; then
rm /var/run/unbound_alarm
fi
+PID=""
+if [ -f "${PIDFILE}" ]; then
+ PID=`head -n 1 ${PIDFILE}`
+fi
if [ "$1" = "stop" ]; then
- pkill -f unbound_monitor.sh
+ if [ -n "${PID}" ] && ps -p ${PID} | grep -q unbound_monitor.sh; then
+ kill ${PID}
+ else
+ pkill -f unbound_monitor.sh
+ fi
exit 0
fi
-PROCS=`/bin/pgrep -f unbound_monitor.sh | wc -l | awk '{print $1}'`
-
-if [ ${PROCS} -gt 1 ]; then
+if [ -n "${PID}" ] && ps -p ${PID} | grep -q unbound_monitor.sh; then
echo "There are another unbound monitor proccess running"
exit 0
fi
+echo $$ > ${PIDFILE}
+
# Sleep 5 seconds on startup not to mangle with existing boot scripts.
sleep 5
while true; do
+ if [ ! -f "${PIDFILE}" ]; then
+ echo $$ > ${PIDFILE}
+ fi
+
if [ ! -f /var/run/unbound_alarm ]; then
- NUM_PROCS=`/bin/pgrep unbound | wc -l | awk '{print $1}'`
+ NUM_PROCS=`pgrep unbound | wc -l | awk '{print $1}'`
if [ $NUM_PROCS -lt 1 ]; then
# Unbound is not running
echo "Unbound has exited." | logger -p daemon.info -i -t Unbound_Alarm
@@ -63,7 +78,7 @@ while true; do
touch /var/run/unbound_alarm
fi
fi
- NUM_PROCS=`/bin/pgrep unbound | wc -l | awk '{print $1}'`
+ NUM_PROCS=`pgrep unbound | wc -l | awk '{print $1}'`
if [ $NUM_PROCS -gt 0 ]; then
if [ -f /var/run/unbound_alarm ]; then
echo "Unbound has resumed." | logger -p daemon.info -i -t Unbound_Alarm
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index 40d6e119..72e6ba73 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -1533,7 +1533,7 @@
<descr>Unbound is a validating, recursive, and caching DNS resolver. This package is a drop in replacement for Services: DNS Forwarder and also supports DNSSEC extensions. Once installed please configure the Unbound service by visiting Services: Unbound DNS.</descr>
<website>http://www.unbound.net/</website>
<category>Services</category>
- <version>1.4.20_4</version>
+ <version>1.4.20_5</version>
<status>Alpha</status>
<maintainer>warren@decoy.co.za</maintainer>
<required_version>2.0</required_version>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index c2958e5d..7217deb4 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -1520,7 +1520,7 @@
<descr>Unbound is a validating, recursive, and caching DNS resolver. This package is a drop in replacement for Services: DNS Forwarder and also supports DNSSEC extensions. Once installed please configure the Unbound service by visiting Services: Unbound DNS.</descr>
<website>http://www.unbound.net/</website>
<category>Services</category>
- <version>1.4.20_4</version>
+ <version>1.4.20_5</version>
<status>Alpha</status>
<maintainer>warren@decoy.co.za</maintainer>
<required_version>2.0</required_version>