From 69245353c05bc3ff35da6afee6c675980ed9c1d0 Mon Sep 17 00:00:00 2001 From: Andrew Marchukov Date: Tue, 11 May 2021 19:32:15 +0300 Subject: [PATCH] remove old code --- AutoUpdater/check-manifest.sh | 55 +++++++++++++++-------------------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/AutoUpdater/check-manifest.sh b/AutoUpdater/check-manifest.sh index 7add388..85b4f0e 100644 --- a/AutoUpdater/check-manifest.sh +++ b/AutoUpdater/check-manifest.sh @@ -4,41 +4,34 @@ rconpass=my_rcon_password modio_api_key=my_modio_apikey_!NOT_OAuth2_KEY! while true; do -# TOTAL=0 sleep $(((RANDOM % 360) + 60)) -# for rconip in $(echo "${rconlist//,/ }"); do -# PLAYERSCOUNT=$(rcon -a "$rconip" -p "$rconpass" listplayers | tail -n +3 | wc -l) -# TOTAL=$(("$PLAYERSCOUNT" + "$TOTAL")) -# done -# if [ $TOTAL -eq 0 ]; then - #CHECKING NEW GAME VERSION - LOCALAPPVER=$(cat /opt/sandstorm-server.version) - REMOTEAPPVER=$(curl -s -X GET 'https://api.steamcmd.net/v1/info/581330' | jq -r -e '.data."581330".depots."581333".manifests.public') + #CHECKING NEW GAME VERSION + LOCALAPPVER=$(cat /opt/sandstorm-server.version) + REMOTEAPPVER=$(curl -s -X GET 'https://api.steamcmd.net/v1/info/581330' | jq -r -e '.data."581330".depots."581333".manifests.public') + EXITSTATUS=$? + if [ $EXITSTATUS -eq 0 ]; then + #CHECKING ISMC NEW VERSION + LOCALMODVER=$(cat /opt/sandstorm-mod.version) + REMOTEMODVER=$(curl -s -X GET "https://api.mod.io/v1/games/254/mods/150867?api_key=$modio_api_key" -H 'Accept: application/json' | jq -r -e .modfile.filehash.md5) EXITSTATUS=$? if [ $EXITSTATUS -eq 0 ]; then - #CHECKING ISMC NEW VERSION - LOCALMODVER=$(cat /opt/sandstorm-mod.version) - REMOTEMODVER=$(curl -s -X GET "https://api.mod.io/v1/games/254/mods/150867?api_key=$modio_api_key" -H 'Accept: application/json' | jq -r -e .modfile.filehash.md5) - EXITSTATUS=$? - if [ $EXITSTATUS -eq 0 ]; then - if [[ ("$LOCALAPPVER" != "$REMOTEAPPVER" || "$LOCALMODVER" != "$REMOTEMODVER") ]]; then - echo "$REMOTEAPPVER" >/opt/sandstorm-server.version - echo "$REMOTEMODVER" >/opt/sandstorm-mod.version - for n in {1800..1}; do - for rconip in $(echo "${rconlist//,/ }"); do - if ((n / 60 == 0)); then - rcon -a "$rconip" -p "$rconpass" "say 'THE SERVER WILL BE RESTARTED IN $n seconds'" - elif ((n % 60 == 0)); then - rcon -a "$rconip" -p "$rconpass" "say 'THE SERVER WILL BE RESTARTED IN $((n / 60)) minutes'" - fi - sleep 1 - done + if [[ ("$LOCALAPPVER" != "$REMOTEAPPVER" || "$LOCALMODVER" != "$REMOTEMODVER") ]]; then + echo "$REMOTEAPPVER" >/opt/sandstorm-server.version + echo "$REMOTEMODVER" >/opt/sandstorm-mod.version + for n in {1800..1}; do + for rconip in $(echo "${rconlist//,/ }"); do + if ((n / 60 == 0)); then + rcon -a "$rconip" -p "$rconpass" "say 'THE SERVER WILL BE RESTARTED IN $n seconds'" + elif ((n % 60 == 0)); then + rcon -a "$rconip" -p "$rconpass" "say 'THE SERVER WILL BE RESTARTED IN $((n / 60)) minutes'" + fi + sleep 1 done - #START OF BLOCK WHERE YOU CAN WRITE RESTART COMMANDS - /opt/restart-ins.sh - #END BLOCK WHERE YOU CAN WRITE RESTART COMMANDS - fi + done + #START OF BLOCK WHERE YOU CAN WRITE RESTART COMMANDS + /opt/restart-ins.sh + #END BLOCK WHERE YOU CAN WRITE RESTART COMMANDS fi fi -# fi + fi done