Ver código fonte

fixed bash sctip for refresh dnsmasq config

root 2 anos atrás
pai
commit
22e5df5023
1 arquivos alterados com 3 adições e 1 exclusões
  1. 3 1
      scripts/update-dnsmasq

+ 3 - 1
scripts/update-dnsmasq

@@ -28,7 +28,9 @@ if [ -n "${CHANGES}" -o -n "${force}" ]; then
         systemctl stop dnsmasq >/dev/null
         systemctl stop dnsmasq >/dev/null
         echo "${CHANGES}" | while read LEASE; do
         echo "${CHANGES}" | while read LEASE; do
             logger -t dhcpd "Clear ${LEASE}"
             logger -t dhcpd "Clear ${LEASE}"
-            sed -i "/${LEASE}/d" /var/lib/misc/dnsmasq.leases
+            if [ -n "${LEASE}" ]; then
+                sed -i "/${LEASE}/d" /var/lib/misc/dnsmasq.leases
+                fi
         done
         done
         systemctl start dnsmasq >/dev/null
         systemctl start dnsmasq >/dev/null
         else
         else