aboutsummaryrefslogtreecommitdiffstats
path: root/config/unbound
diff options
context:
space:
mode:
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