made fix to DNS checking script so it no longer crashes.

This commit is contained in:
2026-03-09 10:11:49 +01:00
parent 9f6b247a4a
commit 2358b986a8

View File

@@ -224,7 +224,7 @@ if [ "$external_access_method" -eq 1 ]; then
# Check A record # Check A record
echo -e "${cyan}Checking A record for @...${nc}" echo -e "${cyan}Checking A record for @...${nc}"
a_record_check=$(dig +short A "$domain" @8.8.8.8 | grep -c "^$publicip$") a_record_check=$(dig +short A "$domain" @8.8.8.8 2>/dev/null | grep -c "^$publicip$" || echo "0")
if [ "$a_record_check" -eq 0 ]; then if [ "$a_record_check" -eq 0 ]; then
echo -e "${cyan}⚠️ Warning: A record for @ is not set or not pointing to $publicip${nc}" echo -e "${cyan}⚠️ Warning: A record for @ is not set or not pointing to $publicip${nc}"
else else
@@ -233,12 +233,13 @@ if [ "$external_access_method" -eq 1 ]; then
# Check CNAME record # Check CNAME record
echo -e "${cyan}Checking CNAME record for *...${nc}" echo -e "${cyan}Checking CNAME record for *...${nc}"
cname_record_check=$(dig +short CNAME "*.$domain" @8.8.8.8 | grep -c "$domain\.$") cname_record_check=$(dig +short CNAME "*.$domain" @8.8.8.8 2>/dev/null | grep -c "$domain\.$" || echo "0")
if [ "$cname_record_check" -eq 0 ]; then if [ "$cname_record_check" -eq 0 ]; then
echo -e "${cyan}⚠️ Warning: CNAME record for * is not set or not pointing to @${nc}" echo -e "${cyan}⚠️ Warning: CNAME record for * is not set or not pointing to @${nc}"
else else
echo -e "${cyan}✅ CNAME record for * is correctly set to @${nc}" echo -e "${cyan}✅ CNAME record for * is correctly set to @${nc}"
fi fi
echo "--------------------------------------------------------" echo "--------------------------------------------------------"
echo -e "please double-check your ${cyan}DNS records${nc} to ensure they are set. the following dns records need to be set:" echo -e "please double-check your ${cyan}DNS records${nc} to ensure they are set. the following dns records need to be set:"
echo "" echo ""
@@ -248,7 +249,6 @@ if [ "$external_access_method" -eq 1 ]; then
echo "" echo ""
echo -e "once you've done this, press any key to ${underline}continue${nc}" echo -e "once you've done this, press any key to ${underline}continue${nc}"
pause_if_enabled pause_if_enabled
fi fi
# Ask about static public IP if using public DNS # Ask about static public IP if using public DNS
if [ "$external_access_method" -eq 1 ]; then if [ "$external_access_method" -eq 1 ]; then