-
Notifications
You must be signed in to change notification settings - Fork 8
/
unbund.sh
21 lines (21 loc) · 839 Bytes
/
unbund.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# Updating Unbound resources.
# Place this into e.g. /etc/cron.monthly or /etc/cron.weekly
###[ root.hints ]###
curl -o /var/lib/unbound/root.hints.new https://www.internic.net/domain/named.cache
if [[ $? -eq 0 ]]; then
mv /var/lib/unbound/root.hints /var/lib/unbound/root.hints.bak
mv /var/lib/unbound/root.hints.new /var/lib/unbound/root.hints
unbound-checkconf >/dev/null
if [[ $? -eq 0 ]]; then
rm /var/lib/unbound/root.hints.bak
service unbound reload >/dev/null
else
echo "Warning: Errors in newly downloaded root.hints file probably due to incomplete download:"
unbound-checkconf
mv /var/lib/unbound/root.hints /var/lib/unbound/root.hints.new
mv /var/lib/unbound/root.hints.bak /var/lib/unbound/root.hints
fi
else
echo "Download of unbound root.hints failed!"
fi