summaryrefslogtreecommitdiffstats
path: root/knot
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2022-11-08 14:39:19 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2022-11-08 14:39:19 +0000
commite4fc8d2795b05039ab689b527a8546fb71d31362 (patch)
tree860bbd820746a44005b09ed7afdc2f1d37d41c87 /knot
parentCorrecting cosmetic typo in dehydrated extra-cert hook output. (diff)
downloadservice-tools-e4fc8d2795b05039ab689b527a8546fb71d31362.tar.xz
service-tools-e4fc8d2795b05039ab689b527a8546fb71d31362.zip
Removing ssh remote part from knot related commands.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-rwxr-xr-xknot-resolver/bin/kresd-cache-clear29
-rwxr-xr-xknot/bin/knot-zones-reset94
2 files changed, 36 insertions, 87 deletions
diff --git a/knot-resolver/bin/kresd-cache-clear b/knot-resolver/bin/kresd-cache-clear
index 49c2462..5b9a0e1 100755
--- a/knot-resolver/bin/kresd-cache-clear
+++ b/knot-resolver/bin/kresd-cache-clear
@@ -21,31 +21,10 @@
set -e
-HOSTS="${*:-localhost}"
+NUMBER="$(systemctl | grep -c 'kresd@[0-9].service')"
-for HOST in ${HOSTS}
+for NUMBER in $(seq 1 "${NUMBER}")
do
- case "${HOST}" in
- localhost)
- NUMBER="$(systemctl | grep -c 'kresd@[0-9].service')"
-
- for NUMBER in $(seq 1 "${NUMBER}")
- do
- echo "Flushing localhost, resolver ${NUMBER}"
- echo "cache.clear()" | sudo socat - UNIX-CONNECT:/run/knot-resolver/control/"${NUMBER}"
- done
- ;;
-
- *)
- NUMBER="$(ssh "${HOST}" sudo systemctl | grep -c 'kresd@[0-9].service')"
-
- for NUMBER in $(seq 1 "${NUMBER}")
- do
- echo "Flushing ${HOST}, resolver ${NUMBER}"
- echo "cache.clear()" | ssh "${HOST}" sudo socat - UNIX-CONNECT:/run/knot-resolver/control/"${NUMBER}"
- done
- ;;
- esac
+ echo "Flushing localhost, resolver ${NUMBER}"
+ echo "cache.clear()" | sudo socat - UNIX-CONNECT:/run/knot-resolver/control/"${NUMBER}"
done
-
-echo
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."