Advertisement
HasterPaster

Update DayZ server mods from Steam

Jul 11th, 2021
1,575
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.26 KB | None | 0 0
  1. @echo off
  2. TITLE DayZ SA Server - Status
  3. COLOR 0A
  4.     :: DEFINE the following variables where applicable to your install
  5.     SET SteamLogin=anonymous
  6.     SET DayZBranch=223350
  7.     SET DayZServerPath="C:\Servers\DayZ"
  8.     SET SteamCMDPath="C:\Servers\SteamCMD"
  9.     SET BECPath="C:\Servers\BEC"
  10.     :: DayZ Mod Parameters
  11.     set DayZModList=(C:\Servers\DayZ\Modlist.txt)
  12.     set SteamCMDWorkshopPath="C:\Servers\SteamCMD\steamapps\workshop\content\221100"
  13.     set SteamCMDDelay=5
  14.     setlocal EnableDelayedExpansion
  15.     :: _______________________________________________________________
  16.  
  17. goto checkServer
  18. pause
  19.  
  20. :checkServer
  21. tasklist /fi "imagename eq DayZServer_x64.exe" 2>NUL | find /i /n "DayZServer_x64.exe">NUL
  22. if "%ERRORLEVEL%"=="0" goto checkBEC
  23. cls
  24. echo Server is not running, taking care of it..
  25. goto killServer
  26.  
  27. :checkBEC
  28. tasklist /fi "imagename eq BEC.exe" 2>NUL | find /i /n "BEC.exe">NUL
  29. if "%ERRORLEVEL%"=="0" goto loopServer
  30. cls
  31. echo Bec is not running, taking care of it..
  32. goto startBEC
  33.  
  34. :loopServer
  35. FOR /L %%s IN (30,-1,0) DO (
  36.     cls
  37.     echo Server is running. Checking again in %%s seconds..
  38.     timeout 1 >nul
  39. )
  40. goto checkServer
  41.  
  42. :killServer
  43. taskkill /f /im Bec.exe
  44. taskkill /f /im DayZServer_x64.exe
  45. taskkill /f /im DZSALModServer.exe
  46. goto updateServer
  47.  
  48. :updateServer
  49. cls
  50. echo Updating DayZ SA Server.
  51. timeout 1 >nul
  52. cls
  53. echo Updating DayZ SA Server..
  54. timeout 1 >nul
  55. cls
  56. echo Updating DayZ SA Server...
  57. cd "%SteamCMDPath%"
  58. steamcmd.exe +login %SteamLogin% +force_install_dir %DayZServerPath% +"app_update %DayZBranch%" +quit
  59. goto updateMods
  60.  
  61. :startServer
  62. cls
  63. echo Starting DayZ SA Server.
  64. timeout 1 >nul
  65. cls
  66. echo Starting DayZ SA Server..
  67. timeout 1 >nul
  68. cls
  69. echo Starting DayZ SA Server...
  70. cd "%DayZServerPath%"
  71. start DZSALModServer.exe -instanceId=1 -config=serverDZ.cfg -profiles=ServerName -port=2302 -mod=!MODS_TO_LOAD!% -cpuCount=8 -noFilePatching -dologs -adminlog -freezecheck
  72. FOR /l %%s IN (45,-1,0) DO (
  73.     cls
  74.     echo Initializing server, wait %%s seconds to initialize BEC..
  75.     timeout 1 >nul
  76. )
  77. goto startBEC
  78.  
  79. :startBEC
  80. cls
  81. echo Starting BEC.
  82. timeout 1 >nul
  83. cls
  84. echo Starting BEC..
  85. timeout 1 >nul
  86. cls
  87. echo Starting BEC...
  88. timeout 1 >nul
  89. cd "%BECPath%"
  90. start Bec.exe -f Config.cfg --dsc
  91. goto checkServer
  92.  
  93. :updateMods
  94. cls
  95. FOR /L %%s IN (%SteamCMDDelay%,-1,0) DO (
  96.     cls
  97.     echo Checking for mod updates in %%s seconds..
  98.     timeout 1 >nul
  99. )
  100. echo Updating Steam Workshop Mods...
  101. @ timeout 1 >nul
  102. cd %SteamCMDPath%
  103. for /f "tokens=1,2 delims=," %%g in %DayZModList% do steamcmd.exe +login %SteamLogin% +workshop_download_item 221100 "%%g" +quit
  104. cls
  105. echo Steam Workshop files are up-to-date! Syncing Workshop source with server destination...
  106. @ timeout 2 >nul
  107. cls
  108. @ for /f "tokens=1,2 delims=," %%g in %DayZModList% do robocopy "%SteamCMDWorkshopPath%\%%g" "%DayZServerPath%\%%h" *.* /mir
  109. @ for /f "tokens=1,2 delims=," %%g in %DayZModList% do forfiles /p "%DayZServerPath%\%%h" /m *.bikey /s /c "cmd /c copy @path %DayZServerPath%\keys"
  110. cls
  111. echo Sync complete!
  112. @ timeout 3 >nul
  113. cls
  114. set "MODS_TO_LOAD="
  115. for /f "tokens=1,2 delims=," %%g in %DayZModList% do (
  116. set "MODS_TO_LOAD=!MODS_TO_LOAD!%%h;"
  117. )
  118. set "MODS_TO_LOAD=!MODS_TO_LOAD:~0,-1!"
  119. ECHO Will start DayZ with the following mods: !MODS_TO_LOAD!%
  120. @ timeout 3 >nul
  121. goto startServer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement