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