summaryrefslogtreecommitdiffstats
path: root/knot/bin
diff options
context:
space:
mode:
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."