Raised This Month: $51 Target: $400
 12% 

Windows | SteamCMD Automatic Updater | Automaticly Update and install any Game Server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
C0nw0nk
Senior Member
Join Date: May 2011
Location: United Kingdom
Old 05-01-2015 , 16:25   Windows | SteamCMD Automatic Updater | Automaticly Update and install any Game Server
Reply With Quote #1

I am sure all of you on windows have been seeking for this for a long time.

This will work for all game servers and keep them all automaticly updated. You may also use this to freshly and easly install game servers too. Inside my script i have written a little a detail on each function and what it is executing and the result. For those of you who are command line enthusiasts like myself.

Why did i bother to make this ?
I got borred and when i get borred i have to do something productive this being the result. (I am a workaholic)

It is a command line file what you should replace your existing .bat / .cmd scripts with, One automatic updater per each game server you wish to run.

Features :
Works with both 32bit and 64bit architecture.
Install game server.
Keep server updated on a interval (interval of updates is defined in seconds).
Should work with both Normal versions of Windows and Server versions.
Suppress application hung messages to prevent server crash problems.

Requirements :
You need to have a SteamDEV API key you can obtain one from the following link http://steamcommunity.com/dev/apikey
Certain servers for specific games require you to use a login on SteamCMD so specify your login in the script.

F.A.Q
I edited beyond the "Do not edit" point and now it does not work ?
I told you in the file not to touch anything beyond that point. (Just redownload the script to get a default working version.)

Known bugs / issues :
  • If your game server is to crash you may have to wait for the next automatic update check as defined by the interval so the script checks if the game server is infact running or not. (Current soloution is to keep the update interval to a max of 10-15mins so if your server crashes it is not offline for long) set interval=60 (1 minute)
  • Certain Appid's for installation of game server will be different to the update id due to Steam's DEV API not containing the latest avaliable server version (yet!?) Example : http://api.steampowered.com/ISteamUs...40&format=json


How to use :
There are two different appid's you might have to specify for your game server to automaticly update. Since some games for example CS:GO has a seperate appid for the updater url than the appid you would use to install the game server as show below.

Install CS:GO server appid = 740
Auto Update URL appid = 730

You will know if you have to set a different appid for the update url if the contents of your latest-version.txt show this.
Code:
{
    "game": {

    }
}
To get the correct Auto Updater APPID just go to the store page for the game in question and it will be at the end of the URL link. http://store.steampowered.com/app/730/

Configuration : (EDIT | steam.cmd file)
Code:
:: This is the SteamDEV api key required for automatic updates ::
:: If you do not have one you may obtain your API key from here = http://steamcommunity.com/dev/apikey ::
set steamkey=

:: This is the required login for SteamCMD to download updates ::
:: example = login=C0nw0nk Password ::
:: For most game servers you do not require this and can leave it as anonymous ::
:: Certain game servers you have to use a username and password to install them ::
set login=anonymous

:: This is the directory you wish to install and keep your server updated to ::
set install_directory=C:\game-servers\CSGO

:: This is for the directory where you installed steamcmd ::
:: http://media.steampowered.com/installer/steamcmd.zip ::
set steamcmd_path=C:\steamcmd\steamcmd.exe

:: This is the path to the exe of the game server this allows us to close and run the server for and after a update ::
:: Other command line variables for srcds can be found here https://developer.valvesoftware.com/wiki/Command_Line_Options ::
:: Example ::
:: set exe_path=C:\game-servers\CSGO\srcds.exe -game csgo -console -nocrashdialog -port 27015 +clientport 27005 +game_type 0 +game_mode 0 +mapgroup mg_active +map de_dust2 ::
set exe_path=C:\game-servers\CSGO\srcds.exe -game csgo -console -nocrashdialog -port 27015 +clientport 27005 +game_type 0 +game_mode 0 +mapgroup mg_active +map de_dust2

:: This is the title of your server this will help you know what server this auto updater is running for ::
set servername=My CSGO#1 Server

:: This is the app ID of the game server you are installing / running ::
set appid=740

:: This is the app ID the url will check for updates on that game ::
:: Some games this is the same as the installation appid other games it is a different numeric value ::
:: if your latest-version.txt file is empty you need to make this value different to the installation appid, just go to the steam store page and get the appid from the end url ::
set update_appid=730

:: Automatic Updating Interval (in seconds) this will set how often you check the steam servers for a new update ::
:: I recommend 5-10 mins maximum ::
:: Default value 60 seconds 1 minute ::
set interval=60

:: Suppress application error messages, Usualy when your game server crashes you get flagged the following error ::
:: "srcds.exe has stopped working. Windows can check online for a solution to the problem" ::
:: and even after disabling error reporting and the message above you will get the following message instead ::
:: "srcds.exe has stopped working. A problem caused the program to stop working correctly. Please close the program" ::
:: With the following setting the script will prevent all these errors and get your server back online as soon as a crash occurs ::
:: set to false to disable this feature ::
:: Use -nocrashdialog in exe_path to also help suppress server crashes ::
set suppress_errors=true
Please drop a reply if you have a question / issue i shall try to help you as much as i can.
CURL (Generic) 32bit and 64bit executable from | http://curl.haxx.se/download.html#Win32

Source code :
https://github.com/C0nw0nk/SteamCMD-...ster/steam.cmd
__________________

Last edited by C0nw0nk; 05-28-2015 at 11:15.
C0nw0nk is offline
Send a message via MSN to C0nw0nk
C0nw0nk
Senior Member
Join Date: May 2011
Location: United Kingdom
Old 05-02-2015 , 23:24   Re: Windows | SteamCMD Automatic Updater | Automaticly Update and install any Game Se
Reply With Quote #2

Updated the script and removed my previous method of checking the OS current architecture.

The previous check method required java to be installed a mistake by me.
Code:
if $SYSTEM_os_arch==x86 (
rem echo OS is 32bit
set curl=curl-32bit.exe
) else (
rem echo OS is 64bit
set curl=curl-64bit.exe
)
The new method uses Windows built in "%PROCESSOR_ARCHITECTURE%" variable.
Code:
if %PROCESSOR_ARCHITECTURE%==x86 (
rem echo OS is 32bit
set curl=curl-32bit.exe
) else (
rem echo OS is 64bit
set curl=curl-64bit.exe
)
So now the script should run as extracted from the zip archive with no need for installation of external programs.
__________________

Last edited by C0nw0nk; 05-03-2015 at 00:05.
C0nw0nk is offline
Send a message via MSN to C0nw0nk
hasan_s_2008
New Member
Join Date: May 2015
Old 05-03-2015 , 09:40   Re: Windows | SteamCMD Automatic Updater | Automaticly Update and install any Game Se
Reply With Quote #3

if we are run several Game Server on a Srcds , We Should config steam.cmd.bat for all server?
we used a srcds for all serves. how I can auto update servers?
all servers need check timer for update????
hasan_s_2008 is offline
C0nw0nk
Senior Member
Join Date: May 2011
Location: United Kingdom
Old 05-03-2015 , 11:15   Re: Windows | SteamCMD Automatic Updater | Automaticly Update and install any Game Se
Reply With Quote #4

I would suggest you just copy over steam.cmd for each server so for example. (One script per each game server) each server will update itself separately.

steam1.cmd
steam2.cmd
steam3.cmd
steam4.cmd
steam5.cmd
steam6.cmd
steam7.cmd

and so on and so forth. That way you will have 7 updater windows. if you leave the default interval. set interval=300 You will end up with your 7 servers checking for updates every 5 minutes. What servers are you running ?
__________________

Last edited by C0nw0nk; 05-03-2015 at 11:22.
C0nw0nk is offline
Send a message via MSN to C0nw0nk
C0nw0nk
Senior Member
Join Date: May 2011
Location: United Kingdom
Old 05-04-2015 , 12:26   Re: Windows | SteamCMD Automatic Updater | Automaticly Update and install any Game Se
Reply With Quote #5

https://github.com/C0nw0nk/SteamCMD-...9193429eb722bb

Updated again due to the fact i accidently nulled out a command to store the game servers process id in a text file meaning every loop a new server would attempt to be started.
Code:
echo %PID% > pid.txt
Also added in server application error crashing / hung fixes to prevent windows error dialogs from preventing a restart upon a server crash.
Code:
set suppress_errors=true

if "%suppress_errors%"=="false" (
) else (
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Windows" /v ErrorMode /t REG_DWORD /d 2 /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\Windows Error Reporting" /v DontShowUI /t REG_DWORD /d 1 /f
)
The script should work fine now.
__________________

Last edited by C0nw0nk; 05-04-2015 at 13:47.
C0nw0nk is offline
Send a message via MSN to C0nw0nk
C0nw0nk
Senior Member
Join Date: May 2011
Location: United Kingdom
Old 05-24-2015 , 20:44   Re: Windows | SteamCMD Automatic Updater | Automaticly Update and install any Game Se
Reply With Quote #6

Updated to 1.6 now when a server is detected to be out of date it will send a console message to the server telling everyone ingame the server is shutting down for updates

https://github.com/C0nw0nk/SteamCMD-...ster/steam.cmd
__________________
C0nw0nk is offline
Send a message via MSN to C0nw0nk
YourMomSE
Junior Member
Join Date: Aug 2014
Old 07-14-2015 , 22:01   Re: Windows | SteamCMD Automatic Updater | Automaticly Update and install any Game Se
Reply With Quote #7

Any idea on how to maybe use this with Firedaemon? We use firedaemon to keep our Ark: Survival Evolved servers running. This software (if you haven't used it) is pretty nifty and basically if the server ever crashes or gets closed down via console commands, it will automatically restart the service. In the command line args, which you list in Firedaemon rather than using a separate batch file, we have it setup to validate the files, which also forces an update.

The inconvenience here is that any admin has to watch for patches, and when one hits, send a broadcast to the server about it, and after the timelimit they announce, they send two commands which save the world(survival game with bases) and then the other command shuts down the server. What I have been looking for is a script like yours that I can use to basically scan for updates for these servers, and upon update being found, either send said rcon commands, or execute another script which I could setup with a command line remote rcon program, to do the broadcasting and then saveworld/quit. Firedaemon would take care of the rest of the situation, meaning running the updater and then starting up the server.

Long wall of text, but any ideas?
YourMomSE is offline
Snaggle
AlliedModders Donor
Join Date: Jul 2010
Location: England
Old 07-15-2015 , 05:44   Re: Windows | SteamCMD Automatic Updater | Automaticly Update and install any Game Se
Reply With Quote #8

Quote:
Originally Posted by YourMomSE View Post
Long wall of text, but any ideas?
I manage my TF2 servers with FD and have this sort of system in place. I would think you would need some kind of server plugin that detects an update and forces the server to shutdown. I don't think you can detect an update with FD or send ingame commands with it.

For TF2 we use the Automatic Steam Update plugin. It detects an update request from Valve and forces your server to shutdown. FireDaemon then runs our update check script before launching SRCDS again.
Snaggle is offline
YourMomSE
Junior Member
Join Date: Aug 2014
Old 07-15-2015 , 21:49   Re: Windows | SteamCMD Automatic Updater | Automaticly Update and install any Game Se
Reply With Quote #9

Yeah, we have the same setup in terms of firedaemon running updates and then starting up our servers. I basically need a script like this that just checks steam and then can execute another script for sending rcon commands, and then shut down the server. Basically a slightly modified version of this. Might give it a go myself, just haven't really had time.
YourMomSE is offline
poppin-fresh
AlliedModders Donor
Join Date: Aug 2010
Old 12-13-2015 , 01:57   Re: Windows | SteamCMD Automatic Updater | Automaticly Update and install any Game Se
Reply With Quote #10

Is there a way to use this to just check if the game is up to date without having to run a server?
poppin-fresh is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:39.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode