summaryrefslogtreecommitdiffstats
path: root/knot/bin
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2022-11-07 21:28:24 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2022-11-07 21:28:24 +0000
commitac76f677f66cabb53ea0947466b05bfe5c9624bb (patch)
tree4d1193c9ee605a88dd5c56341da389d6cd80ff1d /knot/bin
parentReleasing version 20221101. (diff)
downloadservice-tools-ac76f677f66cabb53ea0947466b05bfe5c9624bb.tar.xz
service-tools-ac76f677f66cabb53ea0947466b05bfe5c9624bb.zip
Only restarting knot if it was running before in knot-zones-reset.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-rwxr-xr-xknot/bin/knot-zones-reset14
1 files changed, 12 insertions, 2 deletions
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."