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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 10 deletions

View File

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