Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- TITLE DayZ SA Server - Status
- COLOR 0A
- :: DEFINE the following variables where applicable to your install
- SET SteamCMDPath="C:\Games\SteamCMD"
- SET STEAM_WORKSHOP=C:\Games\SteamCMD\steamapps\workshop\content\221100\
- SET SteamLogin=[user] [password]
- set STEAMCMD_DEL=5
- SET DayZBranch=223350
- SET DayZGameBranch=221100
- SET DayZServerPath="C:\Games\DayzServer"
- SET BECPath=C:\Games\DayzServer\ServerProfile\BattlEye\BEC
- set BEpath="C:\Games\DayzServer\battleye"
- set serverName="server name"
- set profile="C:\Games\DayzServer\ServerProfile"
- set IP=[server ip]]
- set serverPort=[game port]]
- set serverConfig=serverDZ.cfg
- set serverCPU=2
- :: each MOD_LIST file line contains: modID,DayZ_folder_name
- set MOD_LIST=(C:\Games\DayzServer\modlist.txt)
- SET /A modupate=0
- SETLOCAL EnableDelayedExpansion
- :: _______________________________________________________________
- goto checkServer
- pause
- :checkServer
- tasklist /fi "imagename eq DayZServer_x64.exe" 2>NUL | find /i /n "DayZServer_x64.exe">NUL
- if "%ERRORLEVEL%"=="0" goto checkBEC
- rem cls
- echo Server is not running, taking care of it..
- goto killServer
- :checkBEC
- tasklist /fi "imagename eq BEC.exe" 2>NUL | find /i /n "BEC.exe">NUL
- if "%ERRORLEVEL%"=="0" goto loopServer
- rem cls
- echo Bec is not running, taking care of it..
- goto startBEC
- :loopServer
- FOR /L %%s IN (30,-1,0) DO (
- rem cls
- echo Server is running. Checking again in %%s seconds..
- timeout 1 >nul
- )
- IF /I "%modupate%" GEQ "30" (
- SET /A modupdate=0
- goto updateMods
- )
- SET /A modupate+=1
- goto checkServer
- :killServer
- taskkill /f /im Bec.exe
- taskkill /f /im DayZServer_x64.exe
- goto updateServer
- :updateMods
- echo Reading in configurations/variables set in this batch and MOD_LIST. Updating Steam Workshop mods...
- cd %SteamCMDPath%
- @ timeout 1 >nul
- for /f "tokens=1,2 delims=," %%g in %MOD_LIST% do steamcmd.exe +login %SteamLogin% +workshop_download_item 221100 "%%g" +quit +cls
- echo Steam Workshop files up to date!
- rem cls
- goto checkServer
- :updateServer
- rem cls
- FOR /L %%s IN (%STEAMCMD_DEL%,-1,0) DO (
- rem cls
- echo Checking for mod updates in %%s seconds..
- timeout 1 >nul
- )
- echo Updating DayZ server...
- cd %SteamCMDPath%
- steamcmd.exe +login %SteamLogin% +force_install_dir %DayZServerPath% +"app_update %DayZBranch%" +quit
- rem cls
- echo Syncing Workbench source with server destination...
- @ timeout 2 >nul
- @ for /f "tokens=1,2 delims=," %%g in %MOD_LIST% do robocopy "%STEAM_WORKSHOP%\%%g" "%DayZServerPath%\%%h" *.* /mir
- @ for /f "tokens=1,2 delims=," %%g in %MOD_LIST% do forfiles /p "%DayZServerPath%\%%h" /m *.bikey /s /c "cmd /c copy @path %DayZServerPath%\keys"
- rem cls
- echo Sync complete! If sync not completed correctly, verify configuration file.
- @ timeout 3 >nul
- rem cls
- set "MODS_TO_LOAD="
- for /f "tokens=1,2 delims=," %%g in %MOD_LIST% do (
- set "MODS_TO_LOAD=!MODS_TO_LOAD!%%h;"
- )
- set "MODS_TO_LOAD=!MODS_TO_LOAD:~0,-1!"
- ECHO Will start DayZ with the following mods: !MODS_TO_LOAD!%
- @ timeout 3 >nul
- goto startServer
- :startServer
- rem cls
- echo Starting DayZ SA Server.
- timeout 1 >nul
- rem cls
- echo Starting DayZ SA Server..
- timeout 1 >nul
- rem cls
- echo Starting DayZ SA Server...
- cd "%DayZServerPath%"
- start DZSALModServer.exe -config=%serverConfig% -ip=%IP% -port=%serverPort% -cpuCount=%serverCPU% -dologs -adminlog -netlog -freezecheck -scrAllowFileWrite -profiles=%profile% -BEPath=%BEpath% "-mod=!MODS_TO_LOAD!%"
- FOR /l %%s IN (45,-1,0) DO (
- rem cls
- echo Initializing server, wait %%s seconds to initialize BEC..
- timeout 1 >nul
- )
- goto startBEC
- :startBEC
- rem cls
- echo Starting BEC.
- timeout 1 >nul
- rem cls
- echo Starting BEC..
- timeout 1 >nul
- rem cls
- echo Starting BEC...
- timeout 1 >nul
- cd "%BECPath%"
- start Bec.exe -f Config.cfg --dsc
- goto checkServer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement