sandstorm-server/AutoUpdater/check-manifest.sh

25 lines
839 B
Bash
Raw Normal View History

2021-04-24 08:09:22 +00:00
#!/bin/bash
2021-04-28 18:08:51 +00:00
rconlist=127.0.0.1:55555,127.0.0.1:44444,127.0.0.1:33333
rconpass=my_rcon_password
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
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
if [ "$LOCALAPPVER" != "$REMOTEAPPVER" ]; then
2021-04-29 08:52:42 +00:00
export rconlist
export rconpass
2021-04-28 18:08:51 +00:00
/opt/restart-ins.sh
fi
fi
fi
done