-
Notifications
You must be signed in to change notification settings - Fork 0
/
nos-updatescript.bat
44 lines (35 loc) · 1.56 KB
/
nos-updatescript.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
@echo off
setlocal
REM Configuration variables
set "GameServerDir=C:\gameserver\noonesurvivedserver" REM Game server directory
set "SteamCMDDir=C:\SteamCMD" REM SteamCMD directory
set "SteamWebAPIKey=" REM Steam Web API key
set "SteamAppID=2329680" REM App-ID
set "TmpDir=C:\gameserver\tmp\noonesurvivedserver" REM Directory for temporary backup files
set "BackupParentDir=C:\gameserver\backup" REM Directory for storing backup files
REM Capture the current date in YYYY-MM-DD format
for /F "tokens=1-3 delims=-" %%a in ('echo %date%') do (
set "year=%%c"
set "month=%%a"
set "day=%%b"
)
REM Create backup directory name with the current date
set "BackupDir=%BackupParentDir%\%year%-%month%-%day%"
REM Backup the save games
robocopy "%GameServerDir%\WRSH\Saved\SaveGames" "%BackupDir%" /e
REM Backup the configuration files
echo Backing up configuration files...
robocopy "%GameServerDir%\WRSH\Saved\Config\WindowsServer" "%tmpDir%" game.ini gameusersettings.ini
REM Run SteamCMD to update the NoOneSurvived server
echo Updating NoOneSurvived server...
cd /d "%SteamCMDDir%"
steamcmd +@sSteamCmdForcePlatformType windows +force_install_dir "%GameServerDir%" +login anonymous +app_update %SteamAppID% validate +quit
REM Restore the configuration files
echo Restoring configuration files...
robocopy "%tmpDir%" "%GameServerDir%\WRSH\Saved\Config\WindowsServer" game.ini gameusersettings.ini
REM Cleanup: Delete the backup directory
echo Deleting temporary backup files...
rmdir /s /q "%tmpDir%"
echo Update completed.
endlocal
pause