Skip to content

Instantly share code, notes, and snippets.

@RheaAyase
Last active January 17, 2026 15:09
Show Gist options
  • Select an option

  • Save RheaAyase/b3672258c84a0c604a60650a8581225a to your computer and use it in GitHub Desktop.

Select an option

Save RheaAyase/b3672258c84a0c604a60650a8581225a to your computer and use it in GitHub Desktop.
hytale server update script
#!/bin/bash
configFiles="auth.enc config.json bans.json permissions.json whitelist.json"
path=$(dirname $0)
#echo "path = ${path}"
date=$(date -I)
#echo "date -I = ${date}"
latestVersion=$(${path}/hytale-downloader-linux-amd64 -print-version)
echo "latestVersion = ${latestVersion}"
if [ -f "${path}/currentVersion" ]; then
currentVersion=$(cat "${path}/currentVersion")
echo "currentVersion = ${currentVersion}"
if [ ${currentVersion} == ${latestVersion} ]; then
isLatest=true
#echo "isLatest = ${isLatest}"
fi
fi
if [ -z ${isLatest} ]; then
echo "Updating ..."
else
echo "Already latest version."
exit 0
fi
if [ -d "${path}/latest" ]; then
echo "Creating backup in ${path}/${date} ..."
#echo "rsync -ahpog ${path}/latest/ ${path}/${date}"
rsync -ahpog "${path}/latest/" "${path}/${date}"
else
mkdir "${path}/latest"
fi
echo "Downloading the latest archive ..."
${path}/hytale-downloader-linux-amd64
if [ -f "${path}/${latestVersion}.zip" ]; then
echo "Extracting the latest archive ..."
unzip -o -d latest "${path}/${latestVersion}.zip"
for file in ${configFiles}; do
#echo "rsync -ahpog ${path}/${date}/Server/${file} ${path}/latest/Server/"
rsync -ahpog "${path}/${date}/Server/${file}" "${path}/latest/Server/"
done
else
echo "Download failed."
exit 1
fi
echo "${latestVersion}" > "${path}/currentVersion"
echo "DONE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment