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

Release 2024-02-22.2 #222

Merged
merged 3 commits into from
Feb 22, 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
1 change: 1 addition & 0 deletions includes/server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function start_server() {

function stop_server() {
ew ">>> Stopping server..."
kill -SIGTERM "${PLAYER_DETECTION_PID}"
if [[ -n $RCON_ENABLED ]] && [[ $RCON_ENABLED == "true" ]]; then
save_and_shutdown_server
fi
Expand Down
3 changes: 3 additions & 0 deletions scripts/restart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ source /includes/server.sh
source /includes/webhook.sh

function schedule_restart() {
PLAYER_DETECTION_PID=$(<PLAYER_DETECTION.PID)
if [[ -n $WEBHOOK_ENABLED ]] && [[ $WEBHOOK_ENABLED == "true" ]]; then
send_restart_notification
fi
Expand All @@ -25,6 +26,7 @@ function schedule_restart() {
rconcli 'save'
rconcli 'broadcast Saving-done'
sleep 15
kill -SIGTERM "${PLAYER_DETECTION_PID}"
rcon "Shutdown 10"
if [[ -n $WEBHOOK_ENABLED ]] && [[ $WEBHOOK_ENABLED == "true" ]]; then
send_stop_notification
Expand All @@ -36,6 +38,7 @@ function schedule_restart() {
fi
kill -SIGTERM "$(pidof PalServer-Linux-Test)"
tail --pid="$(pidof PalServer-Linux-Test)" -f 2>/dev/null
kill -SIGTERM "${PLAYER_DETECTION_PID}"
ew ">>> Server stopped gracefully"
exit 143;
fi
Expand Down
14 changes: 11 additions & 3 deletions scripts/servermanager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ source /includes/security.sh
source /includes/server.sh
source /includes/webhook.sh

START_MAIN_PID=
PLAYER_DETECTION_PID=



# Handler for SIGTERM from docker-based stop events
function term_handler() {
stop_server
Expand Down Expand Up @@ -43,14 +48,17 @@ do
ei ">>> Starting server manager"
e "> Started at: $current_date $current_time"
start_main &
START_MAIN_PID="$!"

if [[ -n $RCON_PLAYER_DETECTION ]] && [[ $RCON_PLAYER_DETECTION == "true" ]] && [[ -n $RCON_ENABLED ]] && [[ $RCON_ENABLED == "true" ]]; then
player_detection_loop &
PLAYER_DETECTION_PID="$!"
echo $PLAYER_DETECTION_PID > PLAYER_DETECTION.PID
e "> Player detection thread started with pid ${PLAYER_DETECTION_PID}"
fi

killpid="$!"
e "> Server main thread started with pid ${killpid}"
wait ${killpid}
e "> Server main thread started with pid ${START_MAIN_PID}"
wait ${START_MAIN_PID}

if [[ -n $WEBHOOK_ENABLED ]] && [[ $WEBHOOK_ENABLED == "true" ]]; then
send_stop_notification
Expand Down