Update troubleshoot_server.sh

This commit is contained in:
dinger1986
2023-07-10 23:35:57 +01:00
committed by GitHub
parent b7dde1a0d9
commit d7fb76ba74

View File

@@ -23,24 +23,21 @@ osname=$(echo "$osname" | tr '[A-Z]' '[a-z]')
relno=$(lsb_release -sr | cut -d. -f1) relno=$(lsb_release -sr | cut -d. -f1)
# Resolve Locally used DNS server # Resolve Locally used DNS server
if [[ "$osname" == "debian" && "$relno" == 12 ]]; then
locdns=$(resolvconf -l | grep -m 1 -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
else
resolvestatus=$(systemctl is-active systemd-resolved.service) resolvestatus=$(systemctl is-active systemd-resolved.service)
if [ $resolvestatus = active ]; then if [[ "$osname" == "debian" && "$relno" == 12 ]]; then
locdns=$(resolvectl | grep -m 1 -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+') locdns=$(resolvconf -l | tail -n +1 | grep -m 1 -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
echo -e $locdns
elif [ $resolvestatus = active ]; then
locdns=$(resolvectl | tail -n +1 | grep -m 1 -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
else else
while ! [[ $resolveconf ]]; do while ! [[ $resolveconf ]]; do
resolveconf=$(sudo systemctl status systemd-resolved.service | grep "Active: active (running)") resolveconf=$(sudo systemctl status systemd-resolved.service | grep "Active: active (running)")
sudo systemctl start systemd-resolved.service sudo systemctl start systemd-resolved.service
echo -ne "DNS Resolver not ready yet...${NC}\n" echo -ne "DNS Resolver not ready yet...${NC}\n"
sleep 3 sleep 3
done done
locdns=$(resolvectl | grep -m 1 -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+') locdns=$(resolvectl | tail -n +1 | grep -m 1 -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
echo -e $locdns
sudo systemctl stop systemd-resolved.service sudo systemctl stop systemd-resolved.service
fi
fi fi
while [[ $rmmdomain != *[.]*[.]* ]] while [[ $rmmdomain != *[.]*[.]* ]]