Jump to content

ArcticRevrus

Members
  • Content Count

    3
  • Joined

  • Last visited

Posts posted by ArcticRevrus


  1. On 3/11/2019 at 10:00 AM, DrZeddy said:

    When I wrote my backup app, I wanted a way to see if Dayz SA had been updated or not while I was at work.

    So I set my Dayz Server instance to always keep itself up to date in steam, using the steam options for the game (DayzServer)

     

    And I never RAN the server from its default installation path c:\program files (x86)\steam\steamapps\common\dayzserver
    instead I used it as a reference point for checking the version...

    I installed my actual server at C:\DayzServer
    and in the back  up program I checked the file version of the DayzServer_x64.exe in c:\program files (x86\steam\steamapps\common\dayzserver folder  
    and compared it to the DayzServer_x64.exe version  in my c:\dayzserver folder....

    If they didn't match then the server has been updated and my local copy is older...

    This would only apply to locally hosted servers, not remote server...

    Maybe that can help you resolve your issue?

     

     

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


  2. 26 minutes ago, SmashT said:

    Have a look at this, might be what you are after or atleast give you some idea of how to do it yourself. 

    https://old.reddit.com/r/dayz/comments/afad51/automatically_update_and_sync_your_steam_workshop/

    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)

     


  3. 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?

×