-
-
Save Razuuu/581d8f32fd015d634ed69140ce001372 to your computer and use it in GitHub Desktop.
Update root.hints file for bind9
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 | |
# Vars | |
HEREAMI="$(dirname "$(readlink -f "${0}")")" | |
URL="https://www.internic.net/domain/named.root" | |
FILE="/usr/share/dns/root.hints" | |
# Check if file is the same, otherwise override | |
if ! diff -q <(curl -s "${URL}") "${FILE}" > /dev/null 2>&1; then | |
# Download root.hints file | |
curl -s ${URL} -o ${FILE} | |
# Set last updated in file | |
echo "Last updated: $(date +%d.%m.%Y) at $(date +%H:%M:%S)" > ${HEREAMI}/last_updated_root_hints_file.txt | |
fi | |
# Restart bind9/named | |
/usr/bin/systemctl restart named | |
# Exit script | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment