home *** CD-ROM | disk | FTP | other *** search
/ ftp.ac-grenoble.fr / 2015.02.ftp.ac-grenoble.fr.tar / ftp.ac-grenoble.fr / assistance.logicielle / XDBdown.cmd < prev    next >
OS/2 REXX Batch file  |  2013-09-10  |  5KB  |  134 lines

  1. Del "c:\Program Files\SAV\*.xdb" /q
  2. Del "c:\Program Files\SAV\*.vdb" /q
  3.  
  4. @set COPY_XDB_TO="c:\Program Files\SAV\"
  5. @set RAPIDRELEASE=0
  6. @set XDBTEMP=%temp%
  7.  
  8. @rem ==============================================================================================
  9. @rem Set RAPIDRELEASE=1 to download repidrelease definitions, RAPIDRELEASE=0 for fully QA'd definitions (standard).
  10. @rem Change COPY_XDB_TO= to point to the SAV CE server directory (or where you want the XDB file copied)
  11. @rem   you can also run the script directly from the SAV folder and it will copy the definitions there.
  12. @rem XDBTEMP is the temp folder the script will use while downloading definitions, set to %temp% to use system default
  13. @rem ==============================================================================================
  14. @rem  Script for downloading virus definition updates for
  15. @rem  Symantec Antivirus Corporate Edition version 8.x and 9.x
  16. @rem  This unsupported utility is provided for your convenience only.
  17. @rem  Symantec Technical Support cannot provide support for the creation,
  18. @rem  use, or troubleshooting of Windows scripts.
  19.  
  20. @rem ==============================================================================================
  21. @echo off
  22.  
  23.  
  24. rem   ========= check that OS is win2k or better ============
  25. if not "%OS%" == "Windows_NT" goto BADOS
  26. if "%APPDATA%" == "" goto BADOS
  27.  
  28. rem   ========= make sure to be in script directory ============
  29. if exist rtvscan.exe set COPY_XDB_TO=%CD%
  30. for %%i in (%0) do @%%~di
  31. for %%i in (%0) do @cd %%~pi
  32. if exist rtvscan.exe set COPY_XDB_TO=%CD%
  33.  
  34. rem   =========== get name/size of last file from "xdbdown.lastfile" ============
  35. if not exist xdbdown.lastfile goto NOLAST
  36. for /f "tokens=1" %%f in (xdbdown.lastfile) do set lastfile=%%f
  37. for /f "tokens=2" %%f in (xdbdown.lastfile) do set lastsize=%%f
  38. :NOLAST
  39.  
  40. rem   ========= jump to temp dir ============
  41. if not exist "%XDBTEMP%\xdbtmp" md "%XDBTEMP%\xdbtmp"
  42. if exist "%XDBTEMP%\xdbtmp\*.xdb" del "%XDBTEMP%\xdbtmp\*.xdb"
  43. pushd "%XDBTEMP%\xdbtmp"
  44.  
  45. rem   =========== make ftp script for checking xdb directory on ftp ===========
  46. echo open ftp.symantec.com> check.txt
  47. echo anonymous>> check.txt
  48. echo email@address.com>> check.txt
  49. set xdbfolder=xdb
  50. if "%RAPIDRELEASE%" == "1" set xdbfolder=rapidrelease
  51. echo cd AVDEFS/norton_antivirus/%xdbfolder%>> check.txt
  52. echo dir *.xdb chk.lst>> check.txt
  53. echo bye>> check.txt
  54.  
  55. rem   =========== get filename and size from ftp ============
  56. if exist chk.lst del chk.lst
  57. ftp -s:check.txt
  58. if not exist chk.lst goto ERROR
  59. for /f "tokens=9" %%f in (chk.lst) do set xdbfile=%%f
  60. for /f "tokens=5" %%f in (chk.lst) do set xdbsize=%%f
  61. if "%xdbfile%" == "" goto ERROR
  62. if "%xdbsize%" == "" goto ERROR
  63.  
  64. rem   =========== compare ftp name/size to local ============
  65. if not "%xdbfile%" == "%lastfile%" goto DOWNLOAD
  66. if not "%xdbsize%" == "%lastsize%" goto DOWNLOAD
  67. popd
  68. echo.
  69. echo Already downloaded latest %xdbfolder% file: %xdbfile% - size %xdbsize%
  70. echo %date% %time%  Already downloaded latest %xdbfolder% file: %xdbfile% - size %xdbsize% >> XDBdown.log
  71. goto END
  72.  
  73. :DOWNLOAD
  74. rem   ========= make ftp script for downloading new xdb file =========
  75. echo open ftp.symantec.com> down.txt
  76. echo anonymous>> down.txt
  77. echo email@address.com>> down.txt
  78. echo cd AVDEFS/norton_antivirus/%xdbfolder%>> down.txt
  79. echo bin>> down.txt
  80. echo hash>> down.txt
  81. echo get %xdbfile%>> down.txt
  82. echo bye>> down.txt
  83.  
  84. rem   ============= download new file =================
  85. ftp -s:down.txt
  86. for %%i in (%xdbfile%) do @set newsize=%%~zi
  87. if not "%newsize%" == "%xdbsize%" goto ERROR
  88. move %xdbfile% %COPY_XDB_TO%
  89. if exist %xdbfile% goto ERRORMOVE
  90. popd
  91. echo.
  92. echo %xdbfile% %xdbsize% > xdbdown.lastfile
  93. echo Downloaded new %xdbfolder% file: %xdbfile% - size %xdbsize%
  94. echo %date% %time%  Downloaded new %xdbfolder% file: %xdbfile% - size %xdbsize% >> XDBdown.log
  95. goto END
  96.  
  97.  
  98. :ERROR
  99. popd
  100. echo.
  101. echo ERROR: problem downloading %xdbfolder% definition file. xdbfile=%xdbfile% xdbsize=%xdbsize% newsize=%newsize% (lastfile=%lastfile% lastsize=%lastsize%).
  102. echo %date% %time%  ERROR: problem downloading %xdbfolder% definition file. xdbfile=%xdbfile% xdbsize=%xdbsize% newsize=%newsize% (lastfile=%lastfile% lastsize=%lastsize%). >> XDBdown.log
  103. type "%XDBTEMP%\xdbtmp\chk.lst" >> XDBdown.log
  104. echo.  >> XDBdown.log
  105. goto END
  106.  
  107. :ERRORMOVE
  108. popd
  109. echo.
  110. echo ERROR: problem moving definition file to SAV folder. COPY_XDB_TO=%COPY_XDB_TO%  newsize=%newsize% (lastfile=%lastfile% lastsize=%lastsize%).
  111. echo %date% %time%  ERROR: problem moving definition file to SAV folder. COPY_XDB_TO=%COPY_XDB_TO%  newsize=%newsize% (lastfile=%lastfile% lastsize=%lastsize%). >> XDBdown.log
  112. goto END
  113.  
  114. :BADOS
  115. echo.
  116. echo ERROR: this script needs Windows 2000 or better.
  117. echo %date% %time%  ERROR: this script needs Windows 2000 or better. >> XDBdown.log
  118. goto END
  119.  
  120. :END
  121. if exist "%XDBTEMP%\xdbtmp\check.txt" del "%XDBTEMP%\xdbtmp\check.txt"
  122. if exist "%XDBTEMP%\xdbtmp\down.txt" del "%XDBTEMP%\xdbtmp\down.txt"
  123. if exist "%XDBTEMP%\xdbtmp\chk.lst" del "%XDBTEMP%\xdbtmp\chk.lst"
  124. rd "%XDBTEMP%\xdbtmp"
  125. set COPY_XDB_TO=
  126. set RAPIDRELEASE=
  127. set lastsize=
  128. set lastfile=
  129. set newsize=
  130. set xdbsize=
  131. set xdbfile=
  132. set xdbfolder=
  133. set xdbtemp=
  134.