Merge pull request #98 from Dashboy1998/graceful-stop

Graceful stop
This commit is contained in:
Thijs van Loef
2024-01-25 18:23:59 +01:00
committed by GitHub
2 changed files with 18 additions and 2 deletions

View File

@@ -115,7 +115,7 @@ It is highly recommended you set the following environment values before startin
| SERVER_PASSWORD | Secure your community server with a password | | "string" |
| ADMIN_PASSWORD | Secure administration access in the server with a password | | "string" |
| UPDATE_ON_BOOT** | Update/Install the server when the docker container starts (THIS HAS TO BE ENABLED THE FIRST TIME YOU RUN THE CONTAINER) | true | true/false |
| RCON_ENABLED | Enable RCON for the Palworld server | true | true/false |
| RCON_ENABLED*** | Enable RCON for the Palworld server | true | true/false |
| RCON_PORT | RCON port to connect to | 25575 | 1024-65535 |
| QUERY_PORT | Query port used to communicate with Steam servers | 27015 | 1024-65535 |
@@ -123,6 +123,8 @@ It is highly recommended you set the following environment values before startin
** Make sure you know what you are doing when running this option enabled
*** Required for docker stop to save and gracefully close the server
### Game Ports
| Port | Info |

View File

@@ -17,4 +17,18 @@ if [ "${UPDATE_ON_BOOT}" = true ]; then
su steam -c '/home/steam/steamcmd/steamcmd.sh +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit'
fi
./start.sh
term_handler() {
if [ "${RCON_ENABLED}" = true ]; then
rcon-cli save
rcon-cli shutdown 1
else # Does not save
kill -SIGTERM "$(pidof PalServer-Linux-Test)"
fi
tail --pid=$killpid -f 2>/dev/null
}
trap 'term_handler' SIGTERM
./start.sh &
killpid="$!"
wait $killpid