unbound_cache.cmd revision 276541
1@echo off 2rem -------------------------------------------------------------- 3rem -- DNS cache save/load script 4rem -- 5rem -- Version 1.0 6rem -- By Yuri Voinov (c) 2014 7rem -------------------------------------------------------------- 8 9rem Variables 10set prefix="C:\Program Files (x86)" 11set program_path=%prefix%\Unbound 12set uc=%program_path%\unbound-control.exe 13set fname="unbound_cache.dmp" 14 15rem Check Unbound installed 16if exist %uc% goto start 17echo Unbound control not found. Exiting... 18exit 1 19 20:start 21 22set arg=%1 23 24if /I "%arg%" == "-h" goto help 25 26if "%arg%" == "" ( 27echo Loading cache from %program_path%\%fname% 28type %program_path%\%fname%|%uc% load_cache 29goto end 30) 31 32if /I "%arg%" == "-s" ( 33echo Saving cache to %program_path%\%fname% 34%uc% dump_cache>%program_path%\%fname% 35echo ok 36goto end 37) 38 39if /I "%arg%" == "-l" ( 40echo Loading cache from %program_path%\%fname% 41type %program_path%\%fname%|%uc% load_cache 42goto end 43) 44 45if /I "%arg%" == "-r" ( 46echo Saving cache to %program_path%\%fname% 47%uc% dump_cache>%program_path%\%fname% 48echo ok 49echo Loading cache from %program_path%\%fname% 50type %program_path%\%fname%|%uc% load_cache 51goto end 52) 53 54:help 55echo Usage: unbound_cache.cmd [-s] or [-l] or [-r] or [-h] 56echo. 57echo l - Load - default mode. Warming up Unbound DNS cache from saved file. cache-ttl must be high value. 58echo s - Save - save Unbound DNS cache contents to plain file with domain names. 59echo r - Reload - reloadind new cache entries and refresh existing cache 60echo h - this screen. 61echo Note: Run without any arguments will be in default mode. 62echo Also, unbound-control must be configured. 63exit 1 64 65:end 66