diff --git a/README.md b/README.md index 3e9f06d..e5ea4c0 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,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 | @@ -124,6 +124,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 | @@ -135,13 +137,13 @@ It is highly recommended you set the following environment values before startin ## Using RCON RCON is enabled by default for the palworld-server-docker image. -Opening the RCON cli is quite easy: +Opening the RCON CLI is quite easy: ```bash docker exec -it palworld-server rcon-cli ``` -This will open a CLI that use can use to write commands to the Palworld Server. +This will open a CLI that uses RCON to write commands to the Palworld Server. ### List of server commands @@ -162,7 +164,7 @@ For a full list of commands go to: [https://tech.palworldgame.com/server-command ## Creating a backup -To create a backup of the game's save at the current point in time, use the command. +To create a backup of the game's save at the current point in time, use the command: ```bash docker exec palworld-server backup diff --git a/scripts/init.sh b/scripts/init.sh index f1b5bf2..23028be 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -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