[Tool] SSU - Steam Server Updater v1.4

Discussion in 'The Hangar Bay' started by Exacute, Dec 30, 2018.

  1. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    SSU - Steam Server Updater

    Flexible auto-updater, that should be functional for any branch, for any steam-game.

    Download:
    Dropbox

    Feature overview
    -Can be configured to any steam application ID (Supports both games and tools, although aimed towards tools)
    -Can be configured to use any branch, regardless of it requiring a password or not (It won't work, if password isn't correct ofc) (Branches in Empyrion context: Public, Experimental, ClosedAlpha, AlphaX, etc)
    -Using SteamCMD, will determine if a new version is availible for the selected software, and automatically install it, at the given folder
    -Several instances can be run side-by-side. Can use same SteamCMD, Can be placed anywhere.
    -Can be configured to start the software, if it is not currently running.
    -Will keep a timestamped log of all happenings
    -Should be possible to run GUI-less

    If an update is found, it have three stages:
    -Found update
    -Installed update
    -Server started

    Each of the stages, you can
    -Send email(s)
    -Launch additional applications
    -Set the delay to the next stage

    -You can tweak almost everything, including what is sent to the SteamCMD, parameters to pass to the applications, what email to send emails from, the content of the email(s), etc.

    -On the 'Found update' stage, it will end up terminating the current running software, to safely install a new.
    --You can configure this to use telnet to:
    ---'safely' shutdown the server (With provided timeout, incase the server doesn't shutdown on its own)
    ---Send messages every <configurable intervals>, through telnet, notifying about the servers imminent shutdown
    (If no telnet is supplied, or the timeout is exceeded, the process is simply terminated)

    What does it do?

    * Every <n-seconds> it checks, if a process by given exe name, in given folder exists. If not, it starts one. (Keep server alive, can be disabled)
    * Every <n-minutes>, it will first delete the file '<stemcmdlocation>/appcache/appinfo.vdf' (cache-file), then it polls steamcmd, with the params of SteamCMDCheckForUpdateArguments. Returned is a bunch of data, that is searched, if the supplied Config_Branch is found, then compared to the current value of LastDownloadedBuildID.
    ** If so, it will start the update. Depending on configs, it might launch another application here. It might try to communicate over telnet, to the server, messages about an upcoming shutdown n-times
    ** It will then wait <n-minutes> and try to shut the server down. If telnet is supplied, it will try to do it like this. If that doesn't work within <n-minutes>, or if telnet wasn't supplied, it will terminate the process, from the given folder.
    ** It will also terminate any other given processes, if specified, from that same folder.
    ** Then it will do the actual update, where it polls steamCMD with Config_CustomSteamArguments.
    ** Then it will halt, and another window will open with the steamCMD, that shows the entire download happening..
    ** If the halt is less than a minute, it will assume it errored, and retry at next <n-minute-check>
    ** Otherwise, it will depending on the config, launch other executables, and then in <n-minutes> start the server again, potentially launching additional executables.
    ** If configured to do so, it will send email(s) when: 'update found', 'update finished (or failed)', 'server started after update', 'server started after being found down'

    Download:
    Dropbox

    Contribute
    If you like the tool, please feel free to contribute in one of the following ways:
    -Keep an eye out for bugs, and report them
    -Suggest other wordings. English is my second language, so you might be able to explain some of the things better than it currently is.
    -Provide default configuration-files for other games (Make it as plug'n'play-able as possible)
    -Donate: If you feel generous, I won't say no to your money. It will help me to assign more time for future updates (If you want, you can donate here: Donate via Paypal . (Please note, that I do not care for your address, etc, but paypal requires it))
    -Give feedback. Let me know what could be better, or what you would like to see in the future

    License
    You are not allowed to edit this tool.
    You are not allowed to redistribute this tool, or any modified version of it.
    You are allowed, and encouraged, to create new, or to edit the SSU_Configs.txt, and to tailor it to your needs, aswell as share this file with others.
     
    #1
    Last edited: Dec 30, 2018
    [BB]Drifter, RexXxuS and Taelyn like this.
  2. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    FAQ:

    Q: There is already a number of different tools for this, why do we need another one?
    A: Most tools are pretty limited in scope, only focusing on one game. This tool is supposed to be usuable by any steam-app, aswell as any branch. The reason for this tools existance, was the desire to be able to update the 'ClosedAlpha' branch of Empyrion automatically, but it should be flexible enough to be able to serve anything steam-related.

    Q: How do I configure things?
    A: There is a file, SSU_Configs.txt , provided. All configurable tags are present here, aswell as a __comment, below them, explaining the usuage. The file is of JSON format.

    Q: How do I install it?
    A: Installation is pretty simple. Extract it to your desired location, and configure at the very least, where the application is located, what app it is (If using another than the config file was written for), and what branch you wish to use. See the provided readme file for more on this.

    Q: I don't know what my branch is called. How do I find it?
    A: When running the tool, with an appropriate appid, the config file will be updated. The tag 'AvailibleBranches', will contain the branches found, for this application. If ending in a "*", it means the branch is password-protected

    Q: The tool won't work with <steam application>
    A: This is most likely caused, if the application is not a "steam tool". In this case, you will need to change the parameters passed to SteamCMD ('Config_CustomSteamFileLines' and 'SteamCMDCheckForUpdateArguments'), to login with an actual steam account, rather than 'anonymous'. The account must own the software you are trying to update, and you may not be logged into this steam account, on the same device.

    Q: I don't want the server to be started if not running
    A: Just disable the check, by setting 'Config_WatchForServerEverySeconds' to '0'

    Q: What's the deal with '+steamsucks' in the config file?
    A: It is a fittingly named 'invalid parameter' for steamCMD; forcing it to output the fetched data to console, so this tool can read it.

    Q: I don't want to have the server start after finishing an update
    A: Simply set 'Config_DelayInMinutesUntillStartup' to '-1', and it won't happen.

    Q: My server needs to be started from a different application, than the one that is actually the server
    A: Set 'Config_DelayInMinutesUntillStartup' to '-1', and use 'Config_ExecutableToRunWhenServerUpdateIsFinished' to specify the executable you want to run instead.

    Q: My server is running with a lot of 'baggage' (Other applications that needs to be shutdown when the server is)
    A: Simply use 'Config_AdditionalExecutablesToShutdown' to specify them, and they will be terminated, when the server is.

    Q: I need to start multiple applications, rather than just one (For WhenServerUpdateIsFinished) for example
    A: You should write a quick batch script where you include all the things you need started. Then simply call that, from the parameter. (Starts the process, which then starts more processes)
     
    #2
    Last edited: Dec 30, 2018
    Taelyn likes this.
  3. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    Changelog

    v1.4
    *Seemingly, the steamcmd does some weird caching.. added '+app_info_update 1' to update param
    *Exposed update arguments to config, just in case it's needed.
    *Also added delation of '<steamcmd>/appcache/appinfo.vdf' file, as it seemingly is stupid steam caching..
    *Also adding debug line to log, for what branch was found compared to what current is internally.
    *Added timestamps to console output aswell (Was already in log)

    v1.3
    *Fixed issue where logfile would be split in two, and placed two seperate placed.
    *Added replace for "{TimeTaken}" to email, when doing 'Config_EmailsSendToOnFinishedUpdating' mails
    *Added a fail-case, if the update took less than a minute to complete (Steam doesn't provide proper logging outside of their box, so this is the best guess for when something bad have happened). In this case, the mail will include a mark about it likely failed, and the latest buildid+time won't be updated (So it will attempt the update next time the check is scheduled)

    v1.2
    *Moved when file-creation/file-update of the dummy file happens. It is now done when the update is started (post-update-check), so that the 'branchname' will be the actual one, regardless of what the user specified (Casing will be proper, as it comes from steams side.. So regardless of 'ClosedAlpha' or 'closedAlpha', or 'CLOSEDALPHA', etc, it will resolve to what is right according to steam).
    *Added logging function. Can be disabled by config tag 'Config_EnableLogging' (Default true). Logs to folder SSU_Logs, relative to where the config file is. Creates a new log file every time started.
    *Added new config 'Config_WatchForServerEverySeconds'. If set to above 0, will test if a server process is running. If it's not, it will start one.
    *Added an email section for sending mails, if the server was found down.

    v1.1
    *Added 'force close after n-mins', if the telnet shutdown didn't work.
    *Made it wait untill the process is actually terminated.
    *Renamed Configs.txt to SSU_Configs.txt
    *Added changelog ;)
    *Added readme with basic overview of config file & quick-run guide
    *Fixed issue with executable supposed to trigger after update finished, trigger before starting update.
    *Added versionnumber to start
    *Changed when 'updateisrunning' protection triggers. Now before the initial delay, to prevent multiple updates colliding, incase the delay to shutdown allows an updatecheck to happen before.
    *Added more debug notices, especially when delays are involved, to make it clear that something is happening.
    *Added 'working directory' to executables started from this. This should make any relative referincing these files may do work as intended. Directory is set to whereever it was located.
    *Added config option 'Config_AdditionalExecutablesToShutdown', as some processes nests. This will terminate all listed. Note support for relative paths.
    *Tweaked 'is server currently running' detection & termination: If started from a .cmd, and running as a .exe for instance, it will find it now.
    *Fixed issue with termination not working properly. Also added note to readme about potentially needing admin permissions to terminate automatically.
    *Added icon (thx taelyn)
    *Added file-creation of 'SSU_SteamCMDDummyFile.txt' as a file relative to wherever the steamCMD is located.
    *Added config tag 'Config_CustomSteamFileLines', allowing custom files to be created. This file is intended to be used with '+runscript {DummyFile}' for 'Config_CustomSteamArguments', as steam is **** at supporting spaces in filenames/paths.
    *Added mailsupport, for sending when update found / update installed / server started. Multiple people can get a mail, and the message can be specified for each category. Note, that you must provide own email details to send it. (Debug notice for wether or not you can send mail is provided on startup. If false, you havn't specified these fields.)
    *Config_CustomSteamFileLines's lines, and Config_CustomSteamArguments: ' will be replaced with ", as steam is retarded.

    Acknowledgements
    @Taelyn for initial support and bughunting
     
    #3
    Taelyn likes this.

Share This Page