resolved may be included in nsswitch.conf even though systemd-resolved is not running. E.g. Arch Linux includes resolved in nsswitch.conf by default, but systemd-resolved is not enabled by default, which causes this script to fail updating dns. This patch uses the systemd-resolve command, which is included with systemd, to check if systemd-resolved is actually running. Signed-off-by: Trygve Aaberge <trygveaa at gmail.com> --- vpnc-script | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vpnc-script b/vpnc-script index 6a55546..b00dbb9 100755 --- a/vpnc-script +++ b/vpnc-script @@ -116,8 +116,7 @@ else ifconfig_syntax_ptpv6="" fi -grep ^hosts /etc/nsswitch.conf|grep resolve >/dev/null 2>&1 -if [ $? = 0 ];then +if grep -qs '^hosts.*resolve' /etc/nsswitch.conf && (command -v systemd-resolve && systemd-resolve --status) >/dev/null 2>&1; then RESOLVEDENABLED=1 else RESOLVEDENABLED=0 -- Trygve Aaberge