Created
August 20, 2022 19:26
-
-
Save lyjacky11/da4c2acae227a696301a72941892187a to your computer and use it in GitHub Desktop.
Update root.hints file for Pi-Hole Unbound Service
This file contains hidden or 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 | |
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