adblock: additional check for running dns query background task 1952/head
authorDirk Brenken <dirk@brenken.org>
Thu, 12 Nov 2015 13:56:04 +0000 (14:56 +0100)
committerDirk Brenken <dirk@brenken.org>
Thu, 12 Nov 2015 13:56:04 +0000 (14:56 +0100)
fix for possible query log config change (enabled => disabled)

Please apply to upstream - thank you!

Signed-off-by: Dirk Brenken <dirk@brenken.org>
net/adblock/Makefile
net/adblock/files/adblock-helper.sh
net/adblock/files/adblock-update.sh

index 34337b7f0662fe5d56a529295414bf1ea7e84bbb..de89597b6bfab6d3820bfcabdd2e07711a199a9d 100644 (file)
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=adblock
-PKG_VERSION:=0.20.1
+PKG_VERSION:=0.20.2
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0+
 PKG_MAINTAINER:=Dirk Brenken <dirk@brenken.org>
index 206be6ac1f57d05c2bfec20853ed218125ee0db6..944ad8f8b003510c3a58175bd0e466ec25de919d 100644 (file)
@@ -256,6 +256,7 @@ f_envcheck()
     # check dns query log configuration
     #
     adb_querydir="${adb_queryfile%/*}"
+    query_pid="/var/run/adb_query.pid"
     if [ -n "${adb_querydir}" ] && [ -d "${adb_querydir}" ]
     then
         # check find capabilities
@@ -269,11 +270,16 @@ f_envcheck()
             query_ok="true"
             query_name="${adb_queryfile##*/}"
             query_ip="${adb_ip//./\\.}"
-            query_pid="/var/run/query.pid"
             adb_mounts="${adb_mounts} ${adb_querydir}"
         fi
     else
         query_ok="false"
+        if [ -s "${query_pid}" ]
+        then
+            kill -9 $(< "${query_pid}") 2>/dev/null
+            > "${query_pid}"
+            /usr/bin/logger -t "adblock[${pid}]" "info: remove old dns query log background process"
+        fi
         /usr/bin/logger -t "adblock[${pid}]" "info: dns query logging will be disabled"
     fi
 
@@ -293,7 +299,7 @@ f_envcheck()
                 exit 50
             elif [ $((av_space)) -lt $((adb_minspace)) ]
             then
-                /usr/bin/logger -t "adblock[${pid}]" "error: not enough space on device (${mp})"
+                /usr/bin/logger -t "adblock[${pid}]" "error: not enough space left on device (${mp})"
                 exit 55
             fi
         done
@@ -378,8 +384,8 @@ f_remove()
     #
     f_deltemp
 
-    # kill existing domain query log background process,
-    # housekeeping and start of a new process on daily basis
+    # remove existing domain query log background process,
+    # do housekeeping and start a new process on daily basis
     #
     if [ "${query_ok}" = "true" ] && [ "${ntp_ok}" = "true" ]
     then
@@ -389,7 +395,7 @@ f_remove()
             kill -9 $(< "${query_pid}") 2>/dev/null
             > "${query_pid}"
             find "${adb_backupdir}" -maxdepth 1 -type f -mtime +${adb_queryhistory} -name "${query_name}.*" -exec rm -f {} \; 2>/dev/null
-            /usr/bin/logger -t "adblock[${pid}]" "info: kill old query log background process and do logfile housekeeping"
+            /usr/bin/logger -t "adblock[${pid}]" "info: remove old dns query log background process and do logfile housekeeping"
         fi
         if [ ! -s "${query_pid}" ]
         then
index 49f6690561b87e5cb92d045ee6157611dfc8a6c3..cd5ce04d41958aaade9ee3de89ed5f20e108375e 100755 (executable)
@@ -25,7 +25,7 @@
 
 # set script version
 #
-adb_version="0.20.1"
+adb_version="0.20.2"
 
 # get current pid and script directory
 #