summaryrefslogtreecommitdiff
path: root/bin/update_hosts
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2021-06-04 16:43:08 +0200
committerMarc Vertes <mvertes@free.fr>2021-06-04 16:43:08 +0200
commit87b63654a7a881afefddaeb6c3dbbf32105070bb (patch)
tree61d7018ed7eb6da484cdbda9d91edd67c82043a6 /bin/update_hosts
parent2dc5563129877c1aad571e2023a7e9cc8eec5d04 (diff)
update, add fv
Diffstat (limited to 'bin/update_hosts')
-rwxr-xr-xbin/update_hosts6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/update_hosts b/bin/update_hosts
index 75c41d1..e7321bf 100755
--- a/bin/update_hosts
+++ b/bin/update_hosts
@@ -5,7 +5,7 @@
[ "$USER" = root ] || exec sudo "$0" "$@"
-echo "Check from https://github.com/StevenBlack/hosts"
+echo "Checking from https://github.com/StevenBlack/hosts:"
lsd=$(curl -s "https://api.github.com/repos/StevenBlack/hosts/commits?path=hosts&page=1&per_page=1"| jq -r '.[0].commit.committer.date')
echo "last source update: $(date -j -f "%FT%TZ" "$lsd")"
echo "last local update: $(date -r /etc/hosts)"
@@ -14,7 +14,7 @@ echo "last local update: $(date -r /etc/hosts)"
cd /etc
cp -p hosts hosts.old
hosts=$(awk '/^# Custom host /, /^# End of custom host /' hosts.old)
-curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | awk '
+curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | awk '
BEGIN { hosts = ARGV[1]; ARGV[1] = "" }
/^# Custom host / { print hosts; next }
/^# End of custom host / { next }
@@ -22,5 +22,5 @@ curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | aw
' "$hosts" > hosts.new
mv hosts.new hosts
-[ "$(uname -s)" != Darwin ] || dscacheutil -flushcache
+[ "$(uname -s)" != Darwin ] || { dscacheutil -flushcache; killall -HUP mDNSResponder; }
diff -u /etc/hosts.old /etc/hosts | diffstat