Hello,
I would like to write a linux script which runs update before starting the server in a loop.
Idea is that server crash/restart would automatically run update.
The problem is that the "StarMade-Starter.jar" never returns. Is there an option to force it to do only update and exit afterwards?
Here is the script:
Bash:
#!/bin/bash
while true
do
java -jar ./StarMade-Starter.jar -nogui -force -nobackup
./StarMade-dedicated-server-linux.sh
sleep 100
done
I suppose you have to get a bit more crafty than just calling the starter that is primarily intended to launch an interactive client session.
Instead, you'd retrieve the latest available remote version number, compare it to your local version, and if they don't match, download and unpack the latest build.
I'd probably do it by manually downloading the archive and putting it in a designated directory from where the script would unpack it. The reasoning behind that is sometimes a brand new patch may not work as intended, and you might want to have a human confirm it is stable enough, instead of a robot screwing up your world database... of course it could be fully automated if you want to live rough and dangerous ;)
Bash:
PROG_DIR=/path/to/your/starmade
REMOTE=$(wget -q -O- https://registry.star-made.org/api/v1/current_version | awk 'BEGIN {FS="\""} {print $8}')
LOCAL=$(awk 'BEGIN {FS="#"} {print $1}' "${PROG_DIR}/version.txt")
echo "Starmade version: local <${LOCAL}> remote <${REMOTE}>"
There is also
https://files.star-made.org/releasebuildindex.json that you can parse to get even more detailed version info, and could use that to just download those files that have changed (which is basically what StarMade-Starter.jar is doing).
I seem to remember seeing some updater shell or maybe Python script thing on github, but I can't recall the author's name nor that of the script.