Created
January 13, 2019 00:11
-
-
Save Tugzrida/3be26eebf59dafd71a50183c4b2a6ec6 to your computer and use it in GitHub Desktop.
Crude DNS cacher to reduce number of upstream lookups
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 | |
# Requires install of dnsutils package. Can be added to a crontab with root permissions | |
# for however often you want to refresh the cached IP. | |
host="pfclient-upload.planefinder.net" | |
ipaddr=$(dig +short "$host" | awk '{ print ; exit }') | |
grep -v "$host" /etc/hosts | tee /etc/hosts | |
echo "$ipaddr $host" | tee -a /etc/hosts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment