 {"id":52,"date":"2007-05-09T17:39:57","date_gmt":"2007-05-09T22:39:57","guid":{"rendered":"http:\/\/www.networkjack.info\/blog\/2007\/05\/09\/quickdns-change-dns-ttls-with-applescript\/"},"modified":"2007-05-09T17:39:57","modified_gmt":"2007-05-09T22:39:57","slug":"quickdns-change-dns-ttls-with-applescript","status":"publish","type":"post","link":"http:\/\/www.networkjack.info\/blog\/2007\/05\/09\/quickdns-change-dns-ttls-with-applescript\/","title":{"rendered":"QuickDNS &#8211; Change DNS TTLs with AppleScript"},"content":{"rendered":"<p>A client of ours is moving his servers to a new colo soon and like us, uses QuickDNS from <a href=\"http:\/\/www.menandmice.com\/\" title=\"Men &amp; Mice | DNS, DHCP and IP Address Management Solutions\">Men and Mice<\/a> to manage his BIND installations. He needed an AppleScript that would go through all his zones and reduce all the TTL values so that when he moved his servers, the transition would happen as smoothly as possible. So I whipped up this AppleScript:<\/p>\n<pre>\r\nset setDirection to \"low\"\r\n--set setDirection to \"normal\"\r\n\r\ntell application \"QuickDNS Manager\"\r\n  repeat with theZone in zones\r\n    set curZoneName to name of theZone\r\n    set theDoc to (open theZone)\r\n    tell theDoc\r\n      if (\"low\" is setDirection) then\r\n        set default time to live to 7200\r\n        try\r\n          set expire of first SOA record to \"1400\"\r\n        end try\r\n        try\r\n          set refresh of first SOA record to \"7200\"\r\n        end try\r\n        try\r\n          set negative caching of first SOA record to \"7200\"\r\n        end try\r\n        try\r\n          set retry of first SOA record to \"3600\"\r\n        end try\r\n        try\r\n          set time to live of first SOA record to \"7200\"\r\n        end try\r\n      end if\r\n      if (\"normal\" is setDirection) then\r\n        set default time to live to 7200\r\n        try\r\n          set expire of first SOA record to \"604800\"\r\n        end try\r\n        try\r\n          set refresh of first SOA record to \"28800\"\r\n        end try\r\n        try\r\n          set negative caching of first SOA record to \"43200\"\r\n        end try\r\n        try\r\n          set retry of first SOA record to \"7200\"\r\n        end try\r\n        try\r\n          set time to live of first SOA record to \"86400\"\r\n        end try\r\n      end if\r\n\r\n      save with comment \"\"\r\n    end tell\r\n\r\n  end repeat\r\nend tell<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A client of ours is moving his servers to a new colo soon and like us, uses QuickDNS from Men and Mice to manage his&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"http:\/\/www.networkjack.info\/blog\/2007\/05\/09\/quickdns-change-dns-ttls-with-applescript\/\">Continue reading<span class=\"screen-reader-text\">QuickDNS &#8211; Change DNS TTLs with AppleScript<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,8],"tags":[],"class_list":["post-52","post","type-post","status-publish","format-standard","hentry","category-colocation","category-servers","entry"],"_links":{"self":[{"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/posts\/52"}],"collection":[{"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/comments?post=52"}],"version-history":[{"count":0,"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/posts\/52\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/media?parent=52"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/categories?post=52"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.networkjack.info\/blog\/wp-json\/wp\/v2\/tags?post=52"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}