1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-12-24 07:37:04 +00:00

check unbound is up before changing local dns server

This commit is contained in:
KiekerJan 2022-04-17 23:08:12 +02:00
parent d35b068a73
commit 87c9e2381e

View File

@ -327,6 +327,17 @@ if [ -d /etc/unbound/lists.d ]; then
mkdir /etc/unbound/lists.d
fi
systemctl restart unbound
unbound-control -q status
# Only reset the local dns settings if unbound server is running, otherwise we'll
# up with a system with an unusable internet connection
if [ $? -ne 0 ]; then
echo "Recursive DNS server not active"
exit 1
fi
# Modify systemd settings
rm -f /etc/resolv.conf
tools/editconf.py /etc/systemd/resolved.conf \
@ -338,7 +349,6 @@ echo "nameserver 127.0.0.1" > /etc/resolv.conf
# Restart the DNS services.
systemctl restart systemd-resolved
systemctl restart unbound
# ### Fail2Ban Service