Jump to content

ArcticRevrus

Members
  • Content Count

    3
  • Joined

  • Last visited

Everything posted by ArcticRevrus

  1. Hello, I am trying to write an auto-update script for my server that checks if an update is available, and if so uses BERcon to gracefully shut down the server, apply the update with steamcmd, and then restarts the server. I'm having trouble trying to find a reliable source of information for the script to check for updates from. Originally i was using the output of app_info_print in steamcmd to get the current buildid of the game, however no matter what i did, trying to pipe that output in windows always seemed to be incomplete output. Currently the script hits http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2/?key=readacted for gameVersion, however it did not appear to be updated with the patch last week. Is there an endpoint that I can reliably get current server version from a python script?
  2. ArcticRevrus

    Way to check for updates with an external script

    Both a terribly awful yet wonderfully simple solution. Will go with it.
  3. ArcticRevrus

    Way to check for updates with an external script

    Not quite, I am looking for a constantly up to date endpoint that shows what the current server application version is available. The link you provided is only relevant to workshop synchronization using built-in functions. The Steam API is usually the way to go about this for other games, either through the ISteamUserStats/GetSchemaForGame function or with ISteamApps/UpToDateCheck, however the GetSchemaForGame values dont appear to be mantained and ISteamApps/UpToDateCheck does not appear to exist for DayZ. Here is an example of a game that supports the UpToDateCheck function with the steam API https://api.steampowered.com/ISteamApps/UpToDateCheck/v1/?appid=377610&version= While DayZ responds with {"response":{"success":false,"error":"Couldn't get app info for the app specified."}} https://api.steampowered.com/ISteamApps/UpToDateCheck/v1/?appid=223350&version= For GetSchemaForGame, the api replies with a GameVersion, which was updated from '4' to '5' in a previous update, but was not updated to '6' or higher with last wednesday's update. {"game":{"gameName":"DayZ Server","gameVersion":"5","availableGameStats":{}}} For context, below is the python script I have written to handle this. It functions properly when manually setting the value in version.txt to something other than what the API is providing, however if the API does not update, the script is not useful. import os, subprocess, psutil, time, requests, json def getVer(): r = requests.get("http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2/?key=REDACTED&appid=223350") version = r.json()['game']['gameVersion'] return version def verCompare(): verdiff = False os.chdir('E:\\steamcmd') with open('version.txt', "r") as f: if getVer() != f.readlines()[0]: verdiff = True if verdiff == True: with open('version.txt', "w") as f: f.write(getVer()) return True else: return False def checkServer(): running = "DayZServer_x64.exe" in (p.name() for p in psutil.process_iter()) if running == True: return True def openServer(): if not checkServer(): print('Game Server not running, launching server.') os.chdir('E:\\dayzserver') subprocess.Popen(['E:\dayzserver\DayZServer_x64.exe', '-config=serverDZ.cfg', '-port 2302', '-dologs', '-adminlog', '-freezecheck', '-BEPath=E:\\dayzserver\\battleye']) def gracefulUpdate(): subprocess.call(['E:\\battleeye\BERcon', '-host', '127.0.0.1' ,'-port', '2302', '-pw', 'REDACTED', '-cmd', 'say -1 Update Found, Server restarting in 5 minutes.', '-cmd', 'exit']) time.sleep(270) subprocess.call(['E:\\battleeye\BERcon', '-host', '127.0.0.1' ,'-port', '2302', '-pw', 'REDACTED', '-cmd', 'say -1 Update Found, Server restarting in 30 seconds.', '-cmd', 'exit']) time.sleep(30) subprocess.call(['E:\\battleeye\BERcon', '-host', '127.0.0.1' ,'-port', '2302', '-pw', 'REDACTED', '-cmd', '#shutdown', '-cmd', 'exit']) subprocess.call(['E:\\steamcmd\steamcmd', '+login', 'REDACTED', '+force_install_dir E:\dayzserver', '+app_update', '223350', '+exit']) def doUpdate(): if verCompare() == True: print ("Update Detected") if checkServer(): gracefulUpdate() else: subprocess.call(['E:\\steamcmd\steamcmd', '+login', 'REDACTED', '+force_install_dir E:\dayzserver', '+app_update', '223350', '+exit']) print(getVer()) doUpdate() oldtime = time.time() while True: if time.time() - oldtime > 3599: doUpdate() oldtime = time.time() openServer() time.sleep(10)
×