From 8a33c640220babae760927e4ed93919ff402698f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Goran=20Meki=C4=87?= Date: Sun, 26 Mar 2023 17:37:14 +0200 Subject: [PATCH] Handle case when hostname is empty --- scripts/service.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/service.sh b/scripts/service.sh index 15b6ca5..332ffa4 100755 --- a/scripts/service.sh +++ b/scripts/service.sh @@ -14,13 +14,11 @@ SOCKET="${SOCKET_DIR}/reggae.sock" MYPID="" - cleanup() { pkill -P ${MYPID} rm -rf ${SOCKET} } - trap cleanup HUP INT ABRT BUS TERM EXIT @@ -60,7 +58,10 @@ run() { unregister_v6 ${ip} fi fi - /usr/sbin/local-unbound-control flush ${fqdn} + first=$(echo ${fqdn} | cut -f 1 -d '.') + if [ ! -z "${first}" ]; then + /usr/sbin/local-unbound-control flush ${fqdn} + fi done }