From 6f849833b5070a4b09ee721f454fa28f2014e616 Mon Sep 17 00:00:00 2001 From: Andrew Marchukov Date: Wed, 28 Apr 2021 21:08:51 +0300 Subject: [PATCH] update and some fixes --- AutoUpdater/check-manifest.sh | 32 +++++++++++++++++++++----------- AutoUpdater/restart-ins.sh | 10 +++++----- Dockerfile | 8 ++------ config/txt/MapCycle.txt | 9 +++++---- config/txt/Mods.txt | 2 -- modmap.env | 2 +- 6 files changed, 34 insertions(+), 29 deletions(-) diff --git a/AutoUpdater/check-manifest.sh b/AutoUpdater/check-manifest.sh index 10b12e5..eada049 100644 --- a/AutoUpdater/check-manifest.sh +++ b/AutoUpdater/check-manifest.sh @@ -1,12 +1,22 @@ #!/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 +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 + /opt/restart-ins.sh + fi + fi + fi +done diff --git a/AutoUpdater/restart-ins.sh b/AutoUpdater/restart-ins.sh index d240948..e5b2304 100644 --- a/AutoUpdater/restart-ins.sh +++ b/AutoUpdater/restart-ins.sh @@ -2,12 +2,12 @@ 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 + echo "$LOCALAPPVER" >/opt/sandstorm-server.version docker stop sandstorm-modmap docker rm sandstorm-modmap docker run -d --restart always --env-file /home/user/coop-modmap/modmap.env \ ---name sandstorm-modmap --net=host \ --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 + --name sandstorm-modmap --net=host \ + -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 fi diff --git a/Dockerfile b/Dockerfile index 80bf658..a715afb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,6 @@ FROM ubuntu:latest ENV DEBIAN_FRONTEND noninteractive - - -RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y \ +RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y \ lib32gcc1 \ curl \ ca-certificates \ @@ -21,9 +19,7 @@ RUN apt-get update && apt-get install --no-install-recommends --no-install-sugge apt-get autoremove -y && \ rm -rf /var/lib/{apt,dpkg} /var/{cache,log} && \ su "steam" -c "./home/steam/steamcmd/steamcmd.sh +login anonymous +force_install_dir /home/steam/steamcmd/sandstorm/ +app_update 581330 validate +quit" - WORKDIR /home/steam/steamcmd USER steam - ENTRYPOINT /home/steam/steamcmd/steamcmd.sh +login anonymous +force_install_dir /home/steam/steamcmd/sandstorm/ +app_update 581330 +quit && \ -/home/steam/steamcmd/sandstorm/Insurgency/Binaries/Linux/InsurgencyServer-Linux-Shipping -hostname="$HOSTNAME" -Port=$PORT -QueryPort=$QUERYPORT ${LAUNCH_SERVER_ENV} + /home/steam/steamcmd/sandstorm/Insurgency/Binaries/Linux/InsurgencyServer-Linux-Shipping -hostname="$HOSTNAME" -Port=$PORT -QueryPort=$QUERYPORT ${LAUNCH_SERVER_ENV} diff --git a/config/txt/MapCycle.txt b/config/txt/MapCycle.txt index ba450d3..4a6b1c5 100644 --- a/config/txt/MapCycle.txt +++ b/config/txt/MapCycle.txt @@ -1,5 +1,5 @@ +Scenario_Sheds_Checkpoint_Security (Scenario="Scenario_TORO_Checkpoint_Security",Lighting="Day",Mode="Checkpoint") -(Scenario="Scenario_TORO_Checkpoint_Security",Lighting="Night",Mode="Checkpoint") Scenario_CompoundCity_Checkpoint_Security Scenario_Highlands_Checkpoint_Security Scenario_MountainPass_Checkpoint @@ -7,12 +7,10 @@ Scenario_Noshahr_Canals_Checkpoint_Security Scenario_Prison_Checkpoint_Security Scenario_Macedonia_Checkpoint_Security (Scenario="Scenario_ps_cp_sec",Mode="Checkpoint",Lighting="Day") -(Scenario="Scenario_ps_cp_sec",Mode="Checkpoint",Lighting="Night") Scenario_Frost_Checkpoint_Security Scenario_SultanOfDrugs_Checkpoint_Security Scenario_Mud_Village_Checkpoint_Security (Scenario="Scenario_Temple_CP_Sec",Mode="Checkpoint",Lighting="Day") -(Scenario="Scenario_Temple_CP_Sec",Mode="Checkpoint",Lighting="Night") (Scenario="Scenario_Safehouse_Checkpoint_Security",Lighting="Day") Scenario_Diplomacy_Checkpoint_Security Scenario_SaltMine_Checkpoint_Security @@ -26,7 +24,10 @@ Scenario_Oasis_Checkpoint_Security (Scenario="Scenario_Stork_Castle_Checkpoint_Security",Lighting="Day") (Scenario="Scenario_Factory_Checkpoint_Security",Lighting="Day") (Scenario="Scenario_RedwoodReborn_Checkpoint",Lighting="Day") -(Scenario="Scenario_RedwoodReborn_Checkpoint",Lighting="Night") (Scenario="Scenario_RedwoodReborn_Checkpoint",Lighting="Rain") (Scenario="Scenario_RedwoodReborn_Checkpoint",Lighting="Winter") Scenario_TheGreenZone_Checkpoint_Security +Scenario_AbadHills_Checkpoint_Security +(Scenario="Scenario_der_Riese_CP_Sec",Mode="Checkpoint",Lighting="Day") +(Scenario="Scenario_PeakReborn_Checkpoint",Lighting="Day") +(Scenario="Scenario_City_Checkpoint_Security",Lighting="Day") \ No newline at end of file diff --git a/config/txt/Mods.txt b/config/txt/Mods.txt index 593db5a..1014902 100644 --- a/config/txt/Mods.txt +++ b/config/txt/Mods.txt @@ -31,5 +31,3 @@ 760053; GreenZone 132183; WelcomeMessage 101966; Join Leave Message -751403; FpLegs -98685; Jump Shoot diff --git a/modmap.env b/modmap.env index 2f4d06f..43461db 100644 --- a/modmap.env +++ b/modmap.env @@ -1,4 +1,4 @@ HOSTNAME=[ISMC] MOD MAPS ONLY @120hz PORT=12345 QUERYPORT=54321 -LAUNCH_SERVER_ENV=-MapCycle=MapCycle -Mods ModList=Mods.txt -mutators=ISMCarmory_legacy,ImprovedAI,NoRestrictedArea,ScaleBotAmount,AdvancedSupplyPoints,WelcomeMessage,JoinLeaveMessage,FpLegs,JumpShoot -GameStatsToken=my_token -GameStats -GSLTToken=my_token -ModDownloadTravelTo=TORO?Scenario=Scenario_TORO_Checkpoint_Security +LAUNCH_SERVER_ENV=-MapCycle=MapCycle -Mods ModList=Mods.txt -mutators=ISMCarmory_legacy,ImprovedAI,NoRestrictedArea,ScaleBotAmount,AdvancedSupplyPoints,WelcomeMessage,JoinLeaveMessage -GameStatsToken=my_token -GameStats -GSLTToken=my_token -ModDownloadTravelTo=TORO?Scenario=Scenario_TORO_Checkpoint_Security