2015-06-15 20:29:14 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2015-09-15 19:58:46 +01:00
|
|
|
shopt -s extglob
|
|
|
|
|
2015-03-26 18:10:32 +00:00
|
|
|
OS=$(uname -s)
|
|
|
|
REL=$(uname -r)
|
|
|
|
|
|
|
|
function sorry()
|
|
|
|
{
|
|
|
|
echo "Sorry. I do not know how to flush the DNS on this OS."
|
|
|
|
echo "Once you find out, edit $(readlink ${0})."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
case ${OS} in
|
2015-09-15 19:38:24 +01:00
|
|
|
Darwin) PROD_VER=$(sw_vers -productVersion)
|
|
|
|
case ${PROD_VER} in
|
2015-09-15 19:58:46 +01:00
|
|
|
10.10?(.[0-3])) sudo discoveryutil mdnsflushcache
|
|
|
|
;;
|
|
|
|
|
|
|
|
10.6?(.*)) sudo dscacheutil -flushcache
|
|
|
|
;;
|
|
|
|
|
|
|
|
*) sudo killall -HUP mDNSResponder
|
|
|
|
;;
|
2015-03-26 18:10:32 +00:00
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
|
|
|
*) sorry
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|