summaryrefslogtreecommitdiffstats
path: root/knot
diff options
context:
space:
mode:
Diffstat (limited to 'knot')
-rwxr-xr-xknot/bin/knot-zones-reset94
1 files changed, 32 insertions, 62 deletions
diff --git a/knot/bin/knot-zones-reset b/knot/bin/knot-zones-reset
index 63d38fd..8ab2dca 100755
--- a/knot/bin/knot-zones-reset
+++ b/knot/bin/knot-zones-reset
@@ -21,65 +21,35 @@
set -e
-HOSTS="${*:-localhost}"
-
-for HOST in ${HOSTS}
-do
- case "${HOST}" in
- localhost)
- echo "Resetting in-memory data for all zones..."
-
- 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
-
- if [ -e /var/lib/knot/zones/.git ]
- then
- sudo chown -R root:root /var/lib/knot/zones/
-
- cd /var/lib/knot/zones
- sudo git clean -dxf
- sudo git checkout -f
-
- sudo chown -R knot:knot /var/lib/knot/zones/
- fi
-
- case "${START}" in
- true)
- sudo service knot start
- ;;
- esac
-
- echo
- echo "done."
- ;;
-
- *)
- echo "'${HOST}': Resetting in-memory data for all zones..."
-
- ssh "${HOST}" \
- "sudo service knot stop && \
- sudo rm -rf /var/lib/knot/journal/*.mdb && \
- sudo rm -rf /var/lib/knot/timers/*.mdb && \
- if [ -e /var/lib/knot/zones/.git ]; \
- then \
- sudo chown -R root:root /var/lib/knot/zones/; \
- cd /var/lib/knot/zones; \
- sudo git clean -dxf; \
- sudo git checkout -f; \
- sudo chown -R knot:knot /var/lib/knot/zones/; \
- fi; \
- sudo service knot start"
-
- echo
- echo "done."
- ;;
- esac
-done
+echo "Resetting in-memory data for all zones..."
+
+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
+
+if [ -e /var/lib/knot/zones/.git ]
+then
+ sudo chown -R root:root /var/lib/knot/zones/
+
+ cd /var/lib/knot/zones
+ sudo git clean -dxf
+ sudo git checkout -f
+
+ sudo chown -R knot:knot /var/lib/knot/zones/
+fi
+
+case "${START}" in
+ true)
+ sudo service knot start
+ ;;
+esac
+
+echo
+echo "done."