From 315b1680dd533fb94ed7ddde9b8aad2bc738e4b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 30 Apr 2022 23:26:50 +0200 Subject: Restarting kresd threads only if at least one exists to support building chroots in dehydrated service-reload hook. Signed-off-by: Daniel Baumann --- dehydrated/share/hooks/exit_hook.service-reload | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/dehydrated/share/hooks/exit_hook.service-reload b/dehydrated/share/hooks/exit_hook.service-reload index c3fbdc2..ebe2d23 100755 --- a/dehydrated/share/hooks/exit_hook.service-reload +++ b/dehydrated/share/hooks/exit_hook.service-reload @@ -37,17 +37,20 @@ do fi done -NUMBER="$(systemctl | grep -c 'kresd@[0-9].service')" - -if [ "${NUMBER}" -gt 0 ] +if service kresd@1 status > /dev/null 2>&1 then - echo -n " + knot-resolver:" + NUMBER="$(systemctl | grep -c 'kresd@[0-9].service')" + + if [ "${NUMBER}" -gt 0 ] + then + echo -n " + knot-resolver:" - for NUMBER in $(seq 1 "${NUMBER}") - do - echo -n " #${NUMBER}" - service kresd@${NUMBER} restart - done + for NUMBER in $(seq 1 "${NUMBER}") + do + echo -n " #${NUMBER}" + service kresd@${NUMBER} restart + done - echo " done." + echo " done." + fi fi -- cgit v1.2.3