-
-
Save it-engineer-pro/6965e510ff6df1e0eb891e4be4cf1ccc to your computer and use it in GitHub Desktop.
Update root.hints file for Pi-Hole Unbound Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# wget -nv -O named.root https://www.internic.net/domain/named.root | |
echo "[i] Backing up root.hints ..." | |
cd /var/lib/unbound | |
sudo cp root.hints $(date +%F).root.hints | |
if [ -s $(date +%F).root.hints ] | |
then | |
echo "[✓] Backup root.hints success!" | |
echo "" | |
echo "[i] Updating root.hints ..." | |
sudo wget -nv -O named.root https://www.internic.net/domain/named.root | |
if [ -s named.root ] | |
then | |
sudo mv -f named.root root.hints | |
echo "[✓] Update root.hints success!" | |
echo "" | |
echo "[i] Restarting unbound service ..." | |
sudo service unbound restart | |
sudo service unbound status | |
exit 0 | |
else | |
echo "[✗] Update failed!" | |
exit 1 | |
fi | |
else | |
echo "[✗] Backup failed!" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Short bash script for updating root.hints for Unbound DNS server in Pi-Hole.
It can be used, as example for updating root.hints in Bind stack or any other solutions.