diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2022-11-08 14:39:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2022-11-08 14:39:19 +0000 |
commit | e4fc8d2795b05039ab689b527a8546fb71d31362 (patch) | |
tree | 860bbd820746a44005b09ed7afdc2f1d37d41c87 /knot/bin/knot-zones-reset | |
parent | Correcting cosmetic typo in dehydrated extra-cert hook output. (diff) | |
download | service-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-x | knot/bin/knot-zones-reset | 94 |
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." |