I did not want to set dnsmasq to setup a couple of CNAMEs. So I wrote the following little script to do the work. I run it at boot using root's crontab @reboot
You need to put a placeholder in /etc/hosts.
127.0.0.1 search.me
The bash script
lookup=search.me
ip=`dig google.com +short | grep '^[.0-9]*$'`
sed -i -r "s/([0-9]{1,3}\.){3}[0-9]{1,3}\s+$lookup/$ip $lookup/g" /etc/hosts
No comments:
Post a Comment