aboutsummaryrefslogtreecommitdiff
path: root/external/unbound/contrib/unbound_cache.cmd
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2015-04-02 11:16:18 +0200
committerRiccardo Spagni <ric@spagni.net>2015-04-02 11:16:18 +0200
commit1f49833d4fc449d54c95c3235b5c18523e6f8d69 (patch)
treeae027273609339b9b89e3e546552af7a7afb23e7 /external/unbound/contrib/unbound_cache.cmd
parentMerge pull request #248 (diff)
downloadmonero-1f49833d4fc449d54c95c3235b5c18523e6f8d69.tar.xz
update unbound from upstream
Diffstat (limited to 'external/unbound/contrib/unbound_cache.cmd')
-rw-r--r--external/unbound/contrib/unbound_cache.cmd56
1 files changed, 48 insertions, 8 deletions
diff --git a/external/unbound/contrib/unbound_cache.cmd b/external/unbound/contrib/unbound_cache.cmd
index 0f0069388..532162b16 100644
--- a/external/unbound/contrib/unbound_cache.cmd
+++ b/external/unbound/contrib/unbound_cache.cmd
@@ -2,7 +2,7 @@
rem --------------------------------------------------------------
rem -- DNS cache save/load script
rem --
-rem -- Version 1.0
+rem -- Version 1.2
rem -- By Yuri Voinov (c) 2014
rem --------------------------------------------------------------
@@ -19,31 +19,42 @@ exit 1
:start
-set arg=%1
+rem arg1 - command (optional)
+rem arg2 - file name (optional)
+set arg1=%1
+set arg2=%2
-if /I "%arg%" == "-h" goto help
+if /I "%arg1%" == "-h" goto help
-if "%arg%" == "" (
+if "%arg1%" == "" (
echo Loading cache from %program_path%\%fname%
+dir /a %program_path%\%fname%
type %program_path%\%fname%|%uc% load_cache
goto end
)
-if /I "%arg%" == "-s" (
+if defined %arg2% (goto Not_Defined) else (goto Defined)
+
+rem If file not specified; use default dump file
+:Not_defined
+if /I "%arg1%" == "-s" (
echo Saving cache to %program_path%\%fname%
%uc% dump_cache>%program_path%\%fname%
+dir /a %program_path%\%fname%
echo ok
goto end
)
-if /I "%arg%" == "-l" (
+if /I "%arg1%" == "-l" (
echo Loading cache from %program_path%\%fname%
+dir /a %program_path%\%fname%
type %program_path%\%fname%|%uc% load_cache
goto end
)
-if /I "%arg%" == "-r" (
+if /I "%arg1%" == "-r" (
echo Saving cache to %program_path%\%fname%
+dir /a %program_path%\%fname%
%uc% dump_cache>%program_path%\%fname%
echo ok
echo Loading cache from %program_path%\%fname%
@@ -51,15 +62,44 @@ type %program_path%\%fname%|%uc% load_cache
goto end
)
+rem If file name specified; use this filename
+:Defined
+if /I "%arg1%" == "-s" (
+echo Saving cache to %arg2%
+%uc% dump_cache>%arg2%
+dir /a %arg2%
+echo ok
+goto end
+)
+
+if /I "%arg1%" == "-l" (
+echo Loading cache from %arg2%
+dir /a %arg2%
+type %arg2%|%uc% load_cache
+goto end
+)
+
+if /I "%arg1%" == "-r" (
+echo Saving cache to %arg2%
+dir /a %arg2%
+%uc% dump_cache>%arg2%
+echo ok
+echo Loading cache from %arg2%
+type %arg2%|%uc% load_cache
+goto end
+)
+
:help
-echo Usage: unbound_cache.cmd [-s] or [-l] or [-r] or [-h]
+echo Usage: unbound_cache.cmd [-s] or [-l] or [-r] or [-h] [filename]
echo.
echo l - Load - default mode. Warming up Unbound DNS cache from saved file. cache-ttl must be high value.
echo s - Save - save Unbound DNS cache contents to plain file with domain names.
echo r - Reload - reloadind new cache entries and refresh existing cache
echo h - this screen.
+echo filename - file to save/load dumped cache. If not specified, %program_path%\%fname% will be used instead.
echo Note: Run without any arguments will be in default mode.
echo Also, unbound-control must be configured.
exit 1
:end
+exit 0