From ac76f677f66cabb53ea0947466b05bfe5c9624bb Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 7 Nov 2022 22:28:24 +0100 Subject: Only restarting knot if it was running before in knot-zones-reset. Signed-off-by: Daniel Baumann --- knot/bin/knot-zones-reset | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'knot/bin') diff --git a/knot/bin/knot-zones-reset b/knot/bin/knot-zones-reset index 6471cf4..63d38fd 100755 --- a/knot/bin/knot-zones-reset +++ b/knot/bin/knot-zones-reset @@ -29,7 +29,13 @@ do localhost) echo "Resetting in-memory data for all zones..." - sudo service knot stop + if systemctl status knot | grep -qs 'Active: active' + then + START="true" + sudo service knot stop + else + START="false" + fi sudo rm -rf /var/lib/knot/journal/*.mdb sudo rm -rf /var/lib/knot/timers/*.mdb @@ -45,7 +51,11 @@ do sudo chown -R knot:knot /var/lib/knot/zones/ fi - sudo service knot start + case "${START}" in + true) + sudo service knot start + ;; + esac echo echo "done." -- cgit v1.2.3