Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graceful stop #98

Merged
merged 6 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,16 @@ 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 |

*highly recommended to set

** 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 |
Expand Down
16 changes: 15 additions & 1 deletion scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading