From ae010351080935ed76f2819d773aac5f0364489b Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Mon, 23 Sep 2024 11:05:39 +0300 Subject: [PATCH] nordvpn-off: handle unexisting unbound-control, resolvectl and chronyc --- bash/usr-local-bin/nordvpn-off | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bash/usr-local-bin/nordvpn-off b/bash/usr-local-bin/nordvpn-off index 645738a..291d2d5 100755 --- a/bash/usr-local-bin/nordvpn-off +++ b/bash/usr-local-bin/nordvpn-off @@ -32,9 +32,13 @@ sudo systemctl restart NetworkManager.service # at the VPN. sleep 5 #sudo systemctl restart unbound.service -sudo unbound-control reload +if hash unbound-control 2> /dev/null; then + sudo unbound-control reload +fi #sudo systemctl restart systemd-resolved.service -sudo resolvectl flush-caches +if hash resolvectl 2> /dev/null; then + sudo resolvectl flush-caches +fi #sleep 5 # Yggdrasil needs IPv6 @@ -42,8 +46,9 @@ sudo systemctl restart yggdrasil.service # The NTP server will now have access to IPv6 sources, possibly local NTP # servers as well. -sudo chronyc online - +if hash chronyc 2> /dev/null; then + sudo chronyc online +fi # Tor will complain of IP address change and failing guards during # disconnection. sudo systemctl restart tor.service