Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- :: Switch to drive of ARK Server
- C:
- :: Test if cURL is present in PATH
- curl 2>nul
- if not %errorlevel% == 2 (
- echo.
- echo cURL cannot be found!
- echo.
- echo Please download it from http://curl.haxx.se/
- echo and put it into C:\Windows\System32
- echo You might need MSVCR100.DLL aswell.
- goto EXIT
- )
- :: Create temporary ARK Auto Update directory
- md "C:\Temp" 2>nul
- md "C:\Temp\ARK_AutoUpdate" 2>nul
- :: Set local variables
- setlocal EnableExtensions
- :: Your current Server version
- set CURRENT_VERSION=180.1
- set UPDATE_SEARCH_STR=Current (v%CURRENT_VERSION%)
- :: Check if the target update has already happened
- if exist "C:\Temp\ARK_AutoUpdate\updated_from.%CURRENT_VERSION%" (
- goto EXIT
- )
- echo %date% %time% Running update check >>"C:\Temp\ARK_AutoUpdate\autoupdate.log"
- echo %date% %time% Running update check
- :: Pull the first Steam Community General Discussion page (which contains the Patch Notes thread)
- del "C:\Temp\ARK_AutoUpdate\Output.txt" 2>nul
- curl http://steamcommunity.com/app/346110/discussions/ >"C:\Temp\ARK_AutoUpdate\Output.txt" 2>nul
- :: Search for the Current Version search string in the file.
- :: We use negative search since we don't know the next version number.
- findstr /m /i /l /c:"%UPDATE_SEARCH_STR%" "C:\Temp\ARK_AutoUpdate\output.txt" >nul
- if %errorlevel% == 0 (
- :: Current Version string exists. So there is no new update.
- echo %date% %time% No Update available! >>"C:\Temp\ARK_AutoUpdate\autoupdate.log"
- echo No Update available!
- timeout /t 2 /nobreak >nul
- goto EXIT
- ) else (
- :: Current Version string does not exist. An update is available.
- echo %date% %time% Update available! >>"C:\Temp\ARK_AutoUpdate\autoupdate.log"
- echo 1 >"C:\Temp\ARK_AutoUpdate\updated_from.%CURRENT_VERSION%"
- echo Update available!
- :: Kill Server process
- taskkill /F /IM ShooterGameServer.exe >>"C:\Temp\ARK_AutoUpdate\Output.txt"
- timeout /t 5 /nobreak >nul
- :: Run another batch which contains SteamCMD- update server restart stuff. Modify as required.
- cd "\Server\SteamCMD"
- call "update_ark.bat"
- )
- :EXIT
- del "C:\Temp\ARK_AutoUpdate\Output.txt" 2>nul
- endlocal
Advertisement
Add Comment
Please, Sign In to add comment