Jump to content

How to check workshop version


Toni

Recommended Posts

Hi all,

I want to create a batch or powershell script which checks the mods of my server for updates.

What this script should do:

1. Check the version (or date) of the mods installed on my server

2. Check the actual version (or date) of the mods.

3.  Compare 1 and 2 for differences

 

Why i need such a script?  Simply because the new commandline parameter -automanagemods is senseless if there isn't any possibilibty to check for updates first. My server should only restart and update if there is an update available. 

 

For the gameserver itself its no problem to do such s script because there you can check for app_info  (version) with steam commands. Unfortunately i've not found such a command to find the version info of a workshop item.

 

 

Link to comment
Share on other sites

You could use SteamCMD to update each mod and then check if it was updated.

https://developer.valvesoftware.com/wiki/SteamCMD

You can update a mod by running this.

workshop_download_item 346110 <mod id>

(346110 is the App ID for Ark.)

SteamCMD will check if the mod needs an update, and download it if it does. It will also update its own tracking of that mod. You can retrieve info about all tracked mods by running this.

workshop_status 346110

Here is an example using a couple of my own mods.

steamcmd +login anonymous +workshop_download_item 346110 707081776 +workshop_download_item 346110 731049477 +workshop_status 346110 +quit

Running this produces the following output.

Redirecting stderr to 'C:\steamcmd\logs\stderr.txt'
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation
-- type 'quit' to exit --
Loading Steam API...OK.

Connecting anonymously to Steam Public...Logged in OK
Waiting for license info...OK
Downloading item 707081776 ...
Success. Downloaded item 707081776 to "C:\steamcmd\steamapps\workshop\content\346110\707081776" (509517 bytes) Downloading item 731049477 ...
Success. Downloaded item 731049477 to "C:\steamcmd\steamapps\workshop\content\346110\731049477" (671347 bytes) Local workshop items for App 346110:
 Workshop Content folder : "C:\steamcmd\steamapps\workshop" - no update needed
- Item 707081776 : installed (509517 bytes, Thu Jun 23 18:41:54 2016),
- Item 731049477 : installed (671347 bytes, Mon Jul 25 01:05:59 2016),

(Note that it says "no update needed" because I actually ran it twice, and this is the output from the second time.)

In the output, you can see the time the mod was last updated. So, you could parse it to find that information.

Personally, I would rather not have to parse the output. Fortunately, SteamCMD also creates a nicely formatted file that you could parse instead! After updating the mods, take a look at this file: steamapps/workshop/appworkshop_346110.acf

It contains something like this.

"AppWorkshop"
{
	"appid"		"346110"
	"SizeOnDisk"		"1180864"
	"NeedsUpdate"		"0"
	"NeedsDownload"		"0"
	"TimeLastUpdated"		"1470867194"
	"TimeLastAppRan"		"0"
	"WorkshopItemsInstalled"
	{
		"707081776"
		{
			"manifest"		"1803239393731179477"
			"size"		"509517"
			"timeupdated"		"1466721714"
		}
		"731049477"
		{
			"manifest"		"7367830136000311659"
			"size"		"671347"
			"timeupdated"		"1469423159"
		}
	}
	"WorkshopItemDetails"
	{
		"707081776"
		{
			"manifest"		"1803239393731179477"
			"timeupdated"		"1466721714"
			"timetouched"		"1470868502"
		}
		"731049477"
		{
			"manifest"		"7367830136000311659"
			"timeupdated"		"1469423159"
			"timetouched"		"1470868502"
		}
	}
}

As you can see, it lists each mod along with a "timeupdated" value for when it was last updated on the workshop. This is a unix time code, which any language will have a way to convert to a human readable format (if you need to for any reason).

P.S. For a list of all SteamCMD commands, take a look here: https://github.com/dgibbs64/SteamCMD-Commands-List/blob/master/steamcmdcommands.txt

Link to comment
Share on other sites

7 hours ago, Crystal said:

You could use SteamCMD to update each mod and then check if it was updated.

https://developer.valvesoftware.com/wiki/SteamCMD

You can update a mod by running this.


workshop_download_item 346110 <mod id>

(346110 is the App ID for Ark.)

SteamCMD will check if the mod needs an update, and download it if it does. It will also update its own tracking of that mod. You can retrieve info about all tracked mods by running this.


workshop_status 346110

Here is an example using a couple of my own mods.


steamcmd +login anonymous +workshop_download_item 346110 707081776 +workshop_download_item 346110 731049477 +workshop_status 346110 +quit

Running this produces the following output.


Redirecting stderr to 'C:\steamcmd\logs\stderr.txt'
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation
-- type 'quit' to exit --
Loading Steam API...OK.

Connecting anonymously to Steam Public...Logged in OK
Waiting for license info...OK
Downloading item 707081776 ...
Success. Downloaded item 707081776 to "C:\steamcmd\steamapps\workshop\content\346110\707081776" (509517 bytes) Downloading item 731049477 ...
Success. Downloaded item 731049477 to "C:\steamcmd\steamapps\workshop\content\346110\731049477" (671347 bytes) Local workshop items for App 346110:
 Workshop Content folder : "C:\steamcmd\steamapps\workshop" - no update needed
- Item 707081776 : installed (509517 bytes, Thu Jun 23 18:41:54 2016),
- Item 731049477 : installed (671347 bytes, Mon Jul 25 01:05:59 2016),

(Note that it says "no update needed" because I actually ran it twice, and this is the output from the second time.)

In the output, you can see the time the mod was last updated. So, you could parse it to find that information.

Personally, I would rather not have to parse the output. Fortunately, SteamCMD also creates a nicely formatted file that you could parse instead! After updating the mods, take a look at this file: steamapps/workshop/appworkshop_346110.acf

It contains something like this.


"AppWorkshop"
{
	"appid"		"346110"
	"SizeOnDisk"		"1180864"
	"NeedsUpdate"		"0"
	"NeedsDownload"		"0"
	"TimeLastUpdated"		"1470867194"
	"TimeLastAppRan"		"0"
	"WorkshopItemsInstalled"
	{
		"707081776"
		{
			"manifest"		"1803239393731179477"
			"size"		"509517"
			"timeupdated"		"1466721714"
		}
		"731049477"
		{
			"manifest"		"7367830136000311659"
			"size"		"671347"
			"timeupdated"		"1469423159"
		}
	}
	"WorkshopItemDetails"
	{
		"707081776"
		{
			"manifest"		"1803239393731179477"
			"timeupdated"		"1466721714"
			"timetouched"		"1470868502"
		}
		"731049477"
		{
			"manifest"		"7367830136000311659"
			"timeupdated"		"1469423159"
			"timetouched"		"1470868502"
		}
	}
}

As you can see, it lists each mod along with a "timeupdated" value for when it was last updated on the workshop. This is a unix time code, which any language will have a way to convert to a human readable format (if you need to for any reason).

P.S. For a list of all SteamCMD commands, take a look here: https://github.com/dgibbs64/SteamCMD-Commands-List/blob/master/steamcmdcommands.txt

I've created a easier solution for me.

I've created a script which opens the workshop website and take the last updated date from there (A little complicated because steam each time delivers an other date format ^^). After that i compare this date with my lastupdated time for the workshop folders.  If the date from the website is newer than my folder date, then im restarting the ark server with command -automanagedmods.

- - - - - - - - - - - - - -

Doing the updates with workshop_download_item doesn't work because steam cmd only downloads the compressed files, but doesn't decompress it.  

The commandline -automanagedmods does  the decompression too.

So if you create a solution like described above, then you have to download the mods to a seperate folder only to check the versions. And if there was a new version, restart the server with -automanagedmods after that.

 

 

Link to comment
Share on other sites

  • 8 months later...
  • 1 month later...
On 2.8.2016 at 0:59 PM, Toni said:

Hi all,

I want to create a batch or powershell script which checks the mods of my server for updates.

What this script should do:

1. Check the version (or date) of the mods installed on my server

2. Check the actual version (or date) of the mods.

3.  Compare 1 and 2 for differences

Why i need such a script?  Simply because the new commandline parameter -automanagemods is senseless if there isn't any possibilibty to check for updates first. My server should only restart and update if there is an update available. 

For the gameserver itself its no problem to do such s script because there you can check for app_info  (version) with steam commands. Unfortunately i've not found such a command to find the version info of a workshop item.

My solution is an update b*tch, running on the same directory. Therefor no server is needed to stop and it works pretty well to even overwrite files of the (other) servers while those are running. The only minor problem is, that arkmanager always downloads every workshop content to check whether it is new or not. Well, it's not my traffic anyways.

Link to comment
Share on other sites

7 hours ago, andi79h said:

My solution is an update b*tch, running on the same directory. Therefor no server is needed to stop and it works pretty well to even overwrite files of the (other) servers while those are running. The only minor problem is, that arkmanager always downloads every workshop content to check whether it is new or not. Well, it's not my traffic anyways.

Thats really not recommended to update mod data while a server is running. You will run into problems some time :)

 

 

Link to comment
Share on other sites

20 hours ago, Toni said:

Thats really not recommended to update mod data while a server is running. You will run into problems some time :)

Well, yeah. There are just two bad ways: have the server offline for too long and update stuff while active. And even the ARK way with Game.ini's autoload/autoupdate function on mods was patching mods while the (other) servers were alive in a shared-ini-server-setup.

Actually it works pretty well for ~5 month now :D

Link to comment
Share on other sites

  • 4 months later...

I thought id share I don't know if this helps anyone,.... I made the timer 1000 sec to give server time to update before launching it id like to add a checker so it can check if the process is running and if not launch the server / mod update process. 

 Note you may need to change things in this script, paste this into notepad then save as bat file. use windows task scheduler to trigger this bat file on user login (trigger restart with windows task scheduler trigger /r google this stuff its out there!)  I have autosave set 5mins in ini server file so when pc shutdown 5mins is lost. warn players with rcontool once pc boots up the script will backup server,check for server update launch server and server should check mods then boot up. replace info where needed by the way you need rcon tool to display broadcast ingame just google admintool or arkon.
:Backup
@echo off
echo Waiting for backup to Start! /t 10 sec
timeout /t 10
echo Thanks for waiting
title Ark Server Batch Backup Started!
For /f "tokens=1-3 delims=//" %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)
xcopy /s "B:\arkservers\server2\ShooterGame\Saved" "G:\Backup\Automatic\Server2\%mydate%_%mytime%\"
echo Backup created!
@echo off
echo backup Completed! /t 10 sec
timeout /t 10
echo  Thanks for waiting!
goto :UPDATE
:UPDATE
echo Starting game update!
echo %time%: Starting game update>>restartlog.txt
cd %steamcmd_path%
start B:\arkservers\SteamCMD\Win64\steamcmd.exe +login anonymous +force_install_dir B:\arkservers\server2\ +app_update 376030 validate +quit
goto :WAITFORUPDATE
:WAITFORUPDATE
@echo off
echo Waiting for update to finish! /t 1000 sec
timeout /t 1000
echo Thanks for waiting.. Starting Server in 10 sec!
timeout /t 10
goto :START
:START
start ShooterGameServer "ScorchedEarth_P?SessionName=servername?AltSaveDirectoryName=Save2?Port=7777?QueryPort=27018?FastDecayUnsnappedCoreStructures=true?AllowAnyoneBabyImprintCuddle=true?AllowCrateSpawnsOnTopOfStructures=true?DestroyUnconnectedWaterPipes=true?OverrideStructurePlatformPrevention=true?TribeLogDestroyedEnemyStructures=true?ShowFloatingDamageText=true?" -webalarm -servergamelog -EnableIdlePlayerKick -d3d10 -automanagedmods -UseBattlEye -nosteamclient -vday -game -server -ForceAllowCaveFlyers -log -NoTransferFromFiltering -ClusterDirOverride=B:\arkservers\clusters\CrazyCluster -clusterid=clusterservers
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...