Advertisement
dudah84

Updated START.bat that offers skipping update check and checks 4 mod updates in ONE login.

Aug 4th, 2021
1,096
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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=rosageiri_server Vikuras201e
  6.     SET SteamLogin=username password
  7.     SET DayZBranch=223350
  8.     SET DayZServerPath="D:\servers\DayZServer"
  9.     SET SteamCMDPath="D:\servers\steamCMD"
  10.     SET BECPath="D:\servers\BEC"
  11.     :: Server specific vars
  12.     SET ServerProfile="PROFILE"
  13.     SET ServerPort=2302
  14.     :: DayZ Mod Parameters
  15.     set DayZModList=(D:\Servers\DayZServer\Modlist.txt)
  16.     set DayZServerModList=(D:\Servers\DayZServer\ModlistServer.txt)
  17.     set SteamCMDWorkshopPath="D:\Servers\SteamCMD\steamapps\workshop\content\221100"
  18.     set SteamCMDDelay=5
  19.     setlocal EnableDelayedExpansion
  20.     :: Set choice default
  21.     set skipUpd=0
  22.     :: _______________________________________________________________
  23.  
  24. goto choice
  25. pause
  26.  
  27. :: Offer choice to start without updates
  28. :choice
  29. cls
  30. echo Press S to skip checking for updates.
  31. echo Will continue to updates check momentarily...
  32. choice /t 6 /c su /d u
  33. if %errorlevel% EQU 2 goto checkServer
  34. if %errorlevel% EQU 1 goto skipUpdates
  35.  
  36. :skipUpdates
  37. set skipUpd=1
  38. goto killServer
  39.  
  40. :checkServer
  41. @tasklist /fi "imagename eq DayZServer_x64.exe" 2>NUL | find /i /n "DayZServer_x64.exe">NUL
  42. if "%ERRORLEVEL%"=="0" goto checkBEC
  43. cls
  44. echo Server is not running, taking care of it..
  45. goto killServer
  46.  
  47. :checkBEC
  48. @tasklist /fi "imagename eq BEC.exe" 2>NUL | find /i /n "BEC.exe">NUL
  49. if "%ERRORLEVEL%"=="0" goto loopServer
  50. cls
  51. echo Bec is not running, taking care of it..
  52. goto startBEC
  53.  
  54. :loopServer
  55. FOR /L %%s IN (30,-1,0) DO (
  56.     cls
  57.     echo Server is running. Checking again in %%s seconds..
  58.     timeout 1 >nul
  59. )
  60. goto checkServer
  61.  
  62. :killServer
  63. @ taskkill /f /im Bec.exe
  64. @ taskkill /f /im DayZServer_x64.exe
  65. @ taskkill /f /im DZSALModServer.exe
  66. if "%skipUpd%"=="0" goto updateServer
  67. goto loadMods
  68.  
  69. :updateServer
  70. cls
  71. echo Updating DayZ SA Server.
  72. timeout 1 >nul
  73. cls
  74. echo Updating DayZ SA Server..
  75. timeout 1 >nul
  76. cls
  77. echo Updating DayZ SA Server...
  78. cd "%SteamCMDPath%"
  79. steamcmd.exe +login %SteamLogin% +force_install_dir %DayZServerPath% +"app_update %DayZBranch%" +quit
  80. goto updateMods
  81.  
  82. :startServer
  83. cls
  84. echo Starting DayZ SA Server.
  85. timeout 1 >nul
  86. cls
  87. echo Starting DayZ SA Server..
  88. timeout 1 >nul
  89. cls
  90. echo Starting DayZ SA Server...
  91. cd "%DayZServerPath%"
  92. start DZSALModServer.exe -instanceId=1 -config=serverDZ.cfg -profiles=%ServerProfile% -port=%ServerPort% -mod=!MODS_TO_LOAD!% -servermod=!SERVERMODS_TO_LOAD!% -cpuCount=2 -noFilePatching -dologs -adminlog -freezecheck
  93. FOR /l %%s IN (60,-1,0) DO (
  94.     cls
  95.     echo Initializing server, wait %%s seconds to initialize BEC..
  96.     timeout 1 >nul
  97. )
  98.  
  99. goto startBEC
  100.  
  101. :startBEC
  102. cls
  103. echo Starting BEC.
  104. timeout 1 >nul
  105. cls
  106. echo Starting BEC..
  107. timeout 1 >nul
  108. cls
  109. echo Starting BEC...
  110. timeout 1 >nul
  111. cd "%BECPath%"
  112. start Bec.exe -f Config.cfg --dsc
  113. goto checkServer
  114.  
  115. :updateMods
  116. cls
  117. FOR /L %%s IN (%SteamCMDDelay%,-1,0) DO (
  118.     cls
  119.     echo Checking for mod updates in %%s seconds..
  120.     timeout 1 >nul
  121. )
  122. echo Updating Steam Workshop Mods...
  123. @ timeout 1 >nul
  124. (
  125. echo login %SteamLogin%
  126. for /f "tokens=1,2 delims=," %%g in %DayZModList% do echo workshop_download_item 221100 %%g
  127. for /f "tokens=1,2 delims=," %%g in %DayZServerModList% do echo workshop_download_item 221100 %%g
  128. echo quit
  129. )>"%DayZServerPath%\steam_script.txt"
  130. cd %SteamCMDPath%
  131. steamcmd.exe +runscript "%DayZServerPath%\steam_script.txt"
  132.  
  133. echo Steam Workshop files are up-to-date! Syncing Workshop source with server destination...
  134. @ timeout 2 >nul
  135. cls
  136. @ for /f "tokens=1,2 delims=," %%g in %DayZModList% do robocopy "%SteamCMDWorkshopPath%\%%g" "%DayZServerPath%\%%h" *.* /mir
  137. @ for /f "tokens=1,2 delims=," %%g in %DayZModList% do forfiles /p "%DayZServerPath%\%%h" /m *.bikey /s /c "cmd /c copy @path %DayZServerPath%\keys"
  138. @ for /f "tokens=1,2 delims=," %%g in %DayZServerModList% do robocopy "%SteamCMDWorkshopPath%\%%g" "%DayZServerPath%\%%h" *.* /mir
  139. @ for /f "tokens=1,2 delims=," %%g in %DayZServerModList% do forfiles /p "%DayZServerPath%\%%h" /m *.bikey /s /c "cmd /c copy @path %DayZServerPath%\keys"
  140. cls
  141. echo Sync complete!
  142. @ timeout 3 >nul
  143. goto loadMods
  144.  
  145. :loadMods
  146. cls
  147. set "MODS_TO_LOAD="
  148. for /f "tokens=1,2 delims=," %%g in %DayZModList% do (
  149. set "MODS_TO_LOAD=!MODS_TO_LOAD!%%h;"
  150. )
  151. set "MODS_TO_LOAD=!MODS_TO_LOAD:~0,-1!"
  152. set "SERVERMODS_TO_LOAD="
  153. for /f "tokens=1,2 delims=," %%g in %DayZServerModList% do (
  154. set "SERVERMODS_TO_LOAD=!SERVERMODS_TO_LOAD!%%h;"
  155. )
  156. set "SERVERMODS_TO_LOAD=!SERVERMODS_TO_LOAD:~0,-1!"
  157. ECHO Will start DayZ with the following mods: !MODS_TO_LOAD!%
  158. @ timeout 3 >nul
  159. goto startServer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement