add ISMC AutoUpdate check
This commit is contained in:
parent
a203556a53
commit
d4d9cfa276
2 changed files with 28 additions and 24 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
rconlist=127.0.0.1:55555,127.0.0.1:44444,127.0.0.1:33333
|
rconlist=127.0.0.1:55555,127.0.0.1:44444,127.0.0.1:33333
|
||||||
rconpass=my_rcon_password
|
rconpass=my_rcon_password
|
||||||
|
modio_api_key=my_modio_apikey_!NOT_OAuth2_KEY!
|
||||||
while true; do
|
while true; do
|
||||||
TOTAL=0
|
TOTAL=0
|
||||||
sleep $(((RANDOM % 360) + 60))
|
sleep $(((RANDOM % 360) + 60))
|
||||||
|
|
@ -9,15 +9,30 @@ while true; do
|
||||||
PLAYERSCOUNT=$(rcon -a "$rconip" -p "$rconpass" listplayers | tail -n +3 | wc -l)
|
PLAYERSCOUNT=$(rcon -a "$rconip" -p "$rconpass" listplayers | tail -n +3 | wc -l)
|
||||||
TOTAL=$(("$PLAYERSCOUNT" + "$TOTAL"))
|
TOTAL=$(("$PLAYERSCOUNT" + "$TOTAL"))
|
||||||
done
|
done
|
||||||
|
#CHECKING NEW GAME VERSION
|
||||||
if [ $TOTAL -eq 0 ]; then
|
if [ $TOTAL -eq 0 ]; then
|
||||||
LOCALAPPVER=$(cat /opt/sandstorm-server.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')
|
REMOTEAPPVER=$(curl -s -X GET 'https://api.steamcmd.net/v1/info/581330' | jq -r -e '.data."581330".depots."581333".manifests.public')
|
||||||
EXITSTATUS=$?
|
EXITSTATUS=$?
|
||||||
if [ $EXITSTATUS -eq 0 ]; then
|
if [ $EXITSTATUS -eq 0 ]; then
|
||||||
if [ "$LOCALAPPVER" != "$REMOTEAPPVER" ]; then
|
#CHECKING ISMC NEW VERSION
|
||||||
export rconlist
|
LOCALMODVER=$(cat /opt/sandstorm-mod.version)
|
||||||
export rconpass
|
REMOTEMODVER=$(curl -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 {60..1}; do
|
||||||
|
for rconip in $(echo "${rconlist//,/ }"); do
|
||||||
|
rcon -a "$rconip" -p "$rconpass" "say 'THE SERVER WILL BE RESTARTED IN $n'"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
done
|
||||||
|
#START OF BLOCK WHERE YOU CAN WRITE RESTART COMMANDS
|
||||||
/opt/restart-ins.sh
|
/opt/restart-ins.sh
|
||||||
|
#END BLOCK WHERE YOU CAN WRITE RESTART COMMANDS
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
LOCALAPPVER=$(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
|
|
||||||
echo "$LOCALAPPVER" >/opt/sandstorm-server.version
|
|
||||||
for n in {60..1}; do
|
|
||||||
for rconip in $(echo "${rconlist//,/ }"); do
|
|
||||||
rcon -a "$rconip" -p "$rconpass" "say 'THE SERVER WILL BE RESTARTED IN $n'"
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
done
|
|
||||||
docker stop sandstorm-modmap
|
docker stop sandstorm-modmap
|
||||||
docker rm sandstorm-modmap
|
docker rm sandstorm-modmap
|
||||||
docker pull andrewmhub/insurgency-sandstorm
|
docker pull andrewmhub/insurgency-sandstorm
|
||||||
|
|
@ -17,4 +7,3 @@ if [ $EXITSTATUS -eq 0 ]; then
|
||||||
-v /home/user/coop-modmap/Mods:/home/steam/steamcmd/sandstorm/Insurgency/Mods:rw \
|
-v /home/user/coop-modmap/Mods:/home/steam/steamcmd/sandstorm/Insurgency/Mods:rw \
|
||||||
-v /home/user/coop-modmap/config/ini:/home/steam/steamcmd/sandstorm/Insurgency/Saved/Config/LinuxServer:ro \
|
-v /home/user/coop-modmap/config/ini:/home/steam/steamcmd/sandstorm/Insurgency/Saved/Config/LinuxServer:ro \
|
||||||
-v /home/user/coop-modmap/config/txt:/home/steam/steamcmd/sandstorm/Insurgency/Config/Server:ro andrewmhub/insurgency-sandstorm:latest
|
-v /home/user/coop-modmap/config/txt:/home/steam/steamcmd/sandstorm/Insurgency/Config/Server:ro andrewmhub/insurgency-sandstorm:latest
|
||||||
fi
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue