aboutsummaryrefslogtreecommitdiffstats
path: root/config/unbound
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-04-29 12:06:04 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-04-29 12:06:04 -0300
commit90c7a7d4d71ac3470b93977c00b6cfa0a4fae7c1 (patch)
treef9a7eb1b48de8cdcc3f7e6fc14ee773565405582 /config/unbound
parentaa00482962ac65280e0c53af504db6b492e8f309 (diff)
downloadpfsense-packages-90c7a7d4d71ac3470b93977c00b6cfa0a4fae7c1.tar.gz
pfsense-packages-90c7a7d4d71ac3470b93977c00b6cfa0a4fae7c1.tar.bz2
pfsense-packages-90c7a7d4d71ac3470b93977c00b6cfa0a4fae7c1.zip
Improvements on unbound_monitor.sh
- Use internal true since there is no /bin/true - Avoid have multiple instances running - Teach it how to stop
Diffstat (limited to 'config/unbound')
-rwxr-xr-xconfig/unbound/unbound_monitor.sh15
1 files changed, 14 insertions, 1 deletions
diff --git a/config/unbound/unbound_monitor.sh b/config/unbound/unbound_monitor.sh
index 23939311..95cc73f8 100755
--- a/config/unbound/unbound_monitor.sh
+++ b/config/unbound/unbound_monitor.sh
@@ -35,10 +35,23 @@ if [ -f /var/run/unbound_alarm ]; then
rm /var/run/unbound_alarm
fi
+
+if [ "$1" = "stop" ]; then
+ pkill -f unbound_monitor.sh
+ exit 0
+fi
+
+PROCS=`/bin/pgrep -f unbound_monitor.sh | wc -l | awk '{print $1}'`
+
+if [ ${PROCS} -gt 2 ]; then
+ echo "There are another unbound monitor proccess running"
+ exit 0
+fi
+
# Sleep 5 seconds on startup not to mangle with existing boot scripts.
sleep 5
-while [ /bin/true ]; do
+while true; do
if [ ! -f /var/run/unbound_alarm ]; then
NUM_PROCS=`/bin/pgrep unbound | wc -l | awk '{print $1}'`
if [ $NUM_PROCS -lt 1 ]; then