#Windows Server Steam Update and Restart batch files

1 messages · Page 1 of 1 (latest)

minor tide
#

Good evening. I created a few batch files that will check Steam (this assumes you already have Steamcmd installed and functional) for updates every 24 hours and restart the server. It's split into 2 files. The server is started with StartEnshrounded.bat, this first checks and kills the enshrounded_server process and then calls the UpdateEnshrounded.bat, after the update is finished it passes back to the startup batch which will spawn the Enshrouded server in a new window then starts a 24 hour (adjustable to your preferences) restart timer that loops it back to the top. Both files go inside the "C:\Gameservers\enshrouded" folder (adjust to your preferences)

StartEnshrounded.bat

@echo off
:start

echo Killing Enshrouded server ...
taskkill /im enshrouded_server.exe 

::Steam Update Check
call UpdateEnshrouded.bat

@timeout 10 /nobreak
cls
:: start Enshrouded
start "Enshrouded" /NORMAL "C:\Gameservers\enshrouded\enshrouded_server.exe"
 
::Time in seconds before kill server process (43200 = 12 hours, 86400 = 24 hours)
timeout 86400

::Time in seconds to wait before..
@timeout 10 /nobreak
goto start

UpdateEnshrounded.bat

:start
echo off
cls

::update Enshrouded Server
echo Updating Enshrouded on Steam ...
::steamcmd +force_install_dir "c:\GameServers\enshrouded" +login %MODloginName% %MODloginPass% +app_update 2278520 validate +quit
C:\steamcmd\steamcmd +force_install_dir "c:\GameServers\enshrouded" +login anonymous +app_update 2278520 validate +quit
umbral quarry
#

you will need to change any directory to match your the install directory on your particuar PC

bold comet
#

so this should be pointed to the default enshrouded_server directory?

nimble gazelle
#

you dont need exe next to steamcmd for it to execute?

minor tide
#

change it to the directory of your liking just make sure it's consistent across the files.

minor tide
nimble gazelle
#

til

minor tide
#

for good measure add the location steamcmd is installed to your system path

bold comet
#

so example
C:\SERVER\steamcmd\enshrouded_server
or
C:\SERVER\steamcmd\

?

nimble gazelle
#

D:\Server\Enshrouded\steamcmd +force_install_dir "D:\Server\Enshrouded" +login anonymous +app_update 2278520 validate +quit

#

fire thanks for the help my g

minor tide
#

If you run from inside the enshrounded server directory it's a relative path.

minor tide
#

I install steamcmd in it's own directory so that any of my game servers, PixARK, Conan, DayZ, Enshrouded can reach it without having to path to it.

bold comet
#

Gotcha alright

#

thanks for the info

minor tide
#

I just updated the task kill command and removed the /f (force) option so that the server does a graceful shutdown instead of a forced shut down.

#

we don't want to be corrupting anything with a forced shutdown if it can be avoided.

umbral quarry
#

Yeah, I was thinking of adding a copy out of the backup file before it nukes the server. But I dont fully understand when/how Enshrouded keeps the save files around

#

In the event of an issue with shutdown or patching, I want to know I have a safe copy of the backup; lest it be overwritten before the time I can get to it

minor tide
#

you definitely want to shut down before doing any copy of the save file for sure. In the linux side of things, my shell scripts will take a copy and tar gzip it to the backup folder and embed a dated time stamp in the name.

umbral quarry
#

I think you can safely touch the .backup backup file in Windows while it's running

minor tide
#

there a bit more of a clunky alternative on the Windows side for embedding the date in the backup zip but ... yea it's .... clunky.

#

you guys should see my DayZ batch ... I grab Mods with it also.

#

If they ever have proper mod support for this in the future, I could probably put something together to auto-update mods for it as well.

#

It will be super nice when (if) they add rcon support so you can announce a few minutes before a shutdown and restart.