argument for port, env file, auto updater

This commit is contained in:
Philipp 2022-10-11 22:45:00 +02:00
parent b62ddcb741
commit 9c8cd2ee36
Signed by: Philipp
GPG key ID: 9EBD8439AFBAB750
2 changed files with 12 additions and 5 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
.token
.env

View file

@ -1,6 +1,11 @@
#!/bin/bash
version=`curl -s "https://ql.syncore.org/api/query?hosts=88.198.49.46%3A27015" | jq -r .servers[0].info.serverVersion`
if [ -f .env ]
then
export $(cat .env | xargs)
fi
version=`curl -s "https://ql.syncore.org/api/query?hosts=88.198.49.46%3A$1" | jq -r .servers[0].info.serverVersion`
up_to_date=`curl -s "https://api.steampowered.com/ISteamApps/UpToDateCheck/v1/?appid=440&version=${version}" | jq -r .response.up_to_date`
@ -9,6 +14,7 @@ then
echo "Server is up to date, nothin todo."
else
new_version=`curl -s "https://api.steampowered.com/ISteamApps/UpToDateCheck/v1/?appid=440&version=${version}" | jq -r .response.required_version`
echo "There has been an update, server version: ${version}, newest version: ${new_version}"
curl -H "Content-Type: application/json" -d "{\"username\": \"Server Version\", \"content\": \"There has been an update, server version: $version, newest version: $new_version\"}" "https://discord.com/api/webhooks/1027862143871221770/iK9CAShzV5nrVW_k7m9fouHa5EIOPoXCOofCp7ap9JYEKgmlYgaIgf3NJ2YFb_wy-Y7s"
echo "There has been an update, server version: ${version}, newest version: ${new_version}":
curl -H "Content-Type: application/json" -d "{\"username\": \"Server Updater\", \"content\": \"There has been an update, server version: $version, newest version: $new_version\"}" $discord_webhook
(cd ~/docker/tf2; docker compose exec tf2dm-1 ./rcon -H 88.198.49.46 -p $1 -P $rcon_password changelevel cp_process_final)
fi