diff --git a/AutoUpdater/check-manifest.sh b/AutoUpdater/check-manifest.sh new file mode 100644 index 0000000..10b12e5 --- /dev/null +++ b/AutoUpdater/check-manifest.sh @@ -0,0 +1,12 @@ +#!/bin/bash +while true ; do +sleep $(( ( RANDOM % 360 ) + 60 )) +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 +/opt/restart-ins.sh +fi +fi +done \ No newline at end of file diff --git a/AutoUpdater/my-server-check.service b/AutoUpdater/my-server-check.service new file mode 100644 index 0000000..c1436e6 --- /dev/null +++ b/AutoUpdater/my-server-check.service @@ -0,0 +1,14 @@ +[Unit] +Description=check insurgency sandstorm server updates +Requires=network.target + +[Service] +Type=simple +ExecStart=/opt/check-manifest.sh +ExecStop=/bin/kill -s TERM $MAINPID +KillMode=control-group +CPUSchedulingPolicy=idle +Nice=19 + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/AutoUpdater/restart-ins.sh b/AutoUpdater/restart-ins.sh new file mode 100644 index 0000000..5b4d61c --- /dev/null +++ b/AutoUpdater/restart-ins.sh @@ -0,0 +1,9 @@ +#!/bin/bash +docker stop sandstorm-modmap +docker rm sandstorm-modmap +docker run -d --restart always --env-file /home/user/coop-modmap/modmap.env \ +--name sandstorm-modmap -p 12345:12345/udp -p 54321:54321/udp \ +-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/txt:/home/steam/steamcmd/sandstorm/Insurgency/Config/Server:ro andrewmhub/insurgency-sandstorm:latest +curl -X GET 'https://api.steamcmd.net/v1/info/581330' | jq -r '.data."581330".depots."581333".manifests.public' > /opt/sandstorm-server.version \ No newline at end of file