mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 23:08:07 +00:00
Ensure resolver test occurs each second
* Ensure that gravity will run the second the resolver is available * Increase timeout to 120s
This commit is contained in:
parent
2deb2bf03f
commit
47099e2855
18
gravity.sh
18
gravity.sh
@ -77,14 +77,14 @@ gravity_DNSLookup() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Determine if $lookupDomain is resolvable
|
# Determine if $lookupDomain is resolvable
|
||||||
if timeout 5 getent hosts "${lookupDomain}" &> /dev/null; then
|
if timeout 1 getent hosts "${lookupDomain}" &> /dev/null; then
|
||||||
# Print confirmation of resolvability if it had previously failed
|
# Print confirmation of resolvability if it had previously failed
|
||||||
if [[ -n "${secs:-}" ]]; then
|
if [[ -n "${secs:-}" ]]; then
|
||||||
echo -e "${OVER} ${TICK} DNS resolution is now available\\n"
|
echo -e "${OVER} ${TICK} DNS resolution is now available\\n"
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
elif [[ -n "${secs:-}" ]]; then
|
elif [[ -n "${secs:-}" ]]; then
|
||||||
echo -e "${OVER} ${CROSS} DNS resolution is still unavailable, cancelling"
|
echo -e "${OVER} ${CROSS} DNS resolution is not available"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -96,13 +96,15 @@ gravity_DNSLookup() {
|
|||||||
"${PIHOLE_COMMAND}" restartdns
|
"${PIHOLE_COMMAND}" restartdns
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Give time for DNS server to be resolvable
|
# Ensure DNS server is given time to be resolvable
|
||||||
secs="30"
|
secs="120"
|
||||||
while [[ "${secs}" -ne 0 ]]; do
|
echo -ne " ${INFO} Waiting up to ${secs} seconds before continuing..."
|
||||||
[[ "${secs}" -ne 1 ]] && plural="s"
|
until timeout 1 getent hosts "${lookupDomain}" &> /dev/null; do
|
||||||
echo -ne "${OVER} ${INFO} Waiting $secs second${plural} before continuing..."
|
[[ "${secs:-}" -eq 0 ]] && break
|
||||||
sleep 1
|
[[ "${secs:-}" -ne 1 ]] && plural="s"
|
||||||
|
echo -ne "${OVER} ${INFO} Waiting up to ${secs} second${plural} before continuing..."
|
||||||
: $((secs--))
|
: $((secs--))
|
||||||
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
# Try again
|
# Try again
|
||||||
|
Loading…
Reference in New Issue
Block a user