nuclearping

ARK Auto Update Batch

Jun 26th, 2015
501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. @echo off
  2. :: Switch to drive of ARK Server
  3. C:
  4.  
  5. :: Test if cURL is present in PATH
  6. curl 2>nul
  7. if not %errorlevel% == 2 (
  8. echo.
  9. echo cURL cannot be found!
  10. echo.
  11. echo Please download it from http://curl.haxx.se/
  12. echo and put it into C:\Windows\System32
  13. echo You might need MSVCR100.DLL aswell.
  14. goto EXIT
  15. )
  16.  
  17. :: Create temporary ARK Auto Update directory
  18. md "C:\Temp" 2>nul
  19. md "C:\Temp\ARK_AutoUpdate" 2>nul
  20.  
  21. :: Set local variables
  22. setlocal EnableExtensions
  23.  
  24. :: Your current Server version
  25. set CURRENT_VERSION=180.1
  26. set UPDATE_SEARCH_STR=Current (v%CURRENT_VERSION%)
  27.  
  28. :: Check if the target update has already happened
  29. if exist "C:\Temp\ARK_AutoUpdate\updated_from.%CURRENT_VERSION%" (
  30. goto EXIT
  31. )
  32.  
  33. echo %date% %time% Running update check >>"C:\Temp\ARK_AutoUpdate\autoupdate.log"
  34. echo %date% %time% Running update check
  35.  
  36. :: Pull the first Steam Community General Discussion page (which contains the Patch Notes thread)
  37. del "C:\Temp\ARK_AutoUpdate\Output.txt" 2>nul
  38. curl http://steamcommunity.com/app/346110/discussions/ >"C:\Temp\ARK_AutoUpdate\Output.txt" 2>nul
  39.  
  40. :: Search for the Current Version search string in the file.
  41. :: We use negative search since we don't know the next version number.
  42. findstr /m /i /l /c:"%UPDATE_SEARCH_STR%" "C:\Temp\ARK_AutoUpdate\output.txt" >nul
  43. if %errorlevel% == 0 (
  44.  
  45. :: Current Version string exists. So there is no new update.
  46. echo %date% %time% No Update available! >>"C:\Temp\ARK_AutoUpdate\autoupdate.log"
  47. echo No Update available!
  48. timeout /t 2 /nobreak >nul
  49. goto EXIT
  50.  
  51. ) else (
  52.  
  53. :: Current Version string does not exist. An update is available.
  54. echo %date% %time% Update available! >>"C:\Temp\ARK_AutoUpdate\autoupdate.log"
  55. echo 1 >"C:\Temp\ARK_AutoUpdate\updated_from.%CURRENT_VERSION%"
  56. echo Update available!
  57.  
  58. :: Kill Server process
  59. taskkill /F /IM ShooterGameServer.exe >>"C:\Temp\ARK_AutoUpdate\Output.txt"
  60. timeout /t 5 /nobreak >nul
  61.  
  62. :: Run another batch which contains SteamCMD- update server restart stuff. Modify as required.
  63. cd "\Server\SteamCMD"
  64. call "update_ark.bat"
  65.  
  66. )
  67.  
  68. :EXIT
  69. del "C:\Temp\ARK_AutoUpdate\Output.txt" 2>nul
  70. endlocal
Advertisement
Add Comment
Please, Sign In to add comment