Skip to content

Commit

Permalink
fix nordvpn ping issue (#260)
Browse files Browse the repository at this point in the history
Fixing #240  by re-using the existing environmental variable in this script as well
  • Loading branch information
marcelrv authored Feb 15, 2024
1 parent ad9bfe6 commit 908260b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions openvpn/nordvpn/configure-openvpn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,13 @@ download_hostname() {
}

checkDNS() {
res=$(dig +short ${nordvpn_dl})
if [ -z "${HEALTH_CHECK_HOST}" ]; then
checkServer=${nordvpn_dl}
else
checkServer=${HEALTH_CHECK_HOST}
log "Checking DNS using server ${checkServer}"
fi
res=$(dig +short ${checkServer})
if [ -z "${res:-\"\"}" ]; then
log "DNS: ERROR, no dns resolution, dns server unavailable or network problem"
else
Expand All @@ -201,9 +207,9 @@ checkDNS() {
ping -c2 ${nordvpn_dl} 2>&1 >/dev/null
ret=$?
if [ $ret -eq 0 ]; then
log "PING: ok, configurations download site reachable"
log "PING: ok"
else
log "PING: ERROR: cannot ping ${nordvpn_cdn}, network or internet unavailable. Cannot download NORDVPN configuration files"
log "PING: ERROR: cannot ping ${checkServer}, network or internet unavailable. Cannot download NORDVPN configuration files"
fi
return $ret
}
Expand Down

0 comments on commit 908260b

Please sign in to comment.