From b44719cef294af1927508ccf33ac9350ce8694a6 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt <2270806+jammsen@users.noreply.github.com> Date: Fri, 23 Feb 2024 13:35:21 +0100 Subject: [PATCH] Added for local testing, fixed #224 expansion-bug --- CHANGELOG.md | 1 + Dockerfile | 1 + default.env | 1 + docs/ENV_VARS.md | 3 ++- includes/playerdetection.sh | 4 ++-- scripts/restart.sh | 6 +++++- 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68bf84f..d84af3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ## 2024-02-23 - Added new SERVER_SETTINGS_MODE called "rcononly" this will only setup up RCON, everything else is still manually to set (#221) +- Added RESTART_DEBUG_OVERRIDE for local testing ## 2024-02-22 diff --git a/Dockerfile b/Dockerfile index 11339a0..6fdcd70 100644 --- a/Dockerfile +++ b/Dockerfile @@ -68,6 +68,7 @@ ENV DEBIAN_FRONTEND=noninteractive \ BACKUP_RETENTION_AMOUNT_TO_KEEP=72 \ # Restart-settings RESTART_ENABLED=false \ + RESTART_DEBUG_OVERRIDE=false \ RESTART_CRON_EXPRESSION="0 18 * * *" \ # RCON-Playerdection - NEEDS RCON ENABLED! RCON_PLAYER_DETECTION=true \ diff --git a/default.env b/default.env index 44bbd5c..0f797e8 100644 --- a/default.env +++ b/default.env @@ -12,6 +12,7 @@ BACKUP_RETENTION_POLICY=true BACKUP_RETENTION_AMOUNT_TO_KEEP=72 # Restart-settings RESTART_ENABLED=false +RESTART_DEBUG_OVERRIDE=false RESTART_CRON_EXPRESSION="0 18 * * *" # RCON-Playerdection - NEEDS RCON ENABLED! RCON_PLAYER_DETECTION=true diff --git a/docs/ENV_VARS.md b/docs/ENV_VARS.md index cf2d831..de0c9b8 100644 --- a/docs/ENV_VARS.md +++ b/docs/ENV_VARS.md @@ -22,10 +22,11 @@ These settings control the behavior of the Docker container: | BACKUP_RETENTION_POLICY | Set to enabled, will cleanup old backups | true | Boolean | | BACKUP_RETENTION_AMOUNT_TO_KEEP | Defines how many backups in numbers to keep | 72 | Integer | | RESTART_ENABLED | Automatic restarts the server | false | Boolean | +| RESTART_DEBUG_OVERRIDE | Automatic restarts down to 15 seconds instead of 15 minutes | false | Boolean | | RESTART_CRON_EXPRESSION | Needs a Cron-Expression - See [Cron expression](#cron-expression) | 0 3,15 * * * | Cron-Expression | | RCON_PLAYER_DETECTION | Set to enabled will send player join and leaves to console, rcon and webhooks, NEEDS `RCON_ENABLED` | true | Boolean | | RCON_PLAYER_DETECTION_STARTUP_DELAY | Initial delay for start checking for players, consider steam-updates and server start up in seconds | 60 | Integer | -| RCON_PLAYER_DETECTION_CHECK_INTERVAL | Interval in seconds to wait for next check in the infinite loop | 15 | Integer | +| RCON_PLAYER_DETECTION_CHECK_INTERVAL | Interval in seconds to wait for next check in the infinite loop | 15 | Integer | | WEBHOOK_ENABLED | Set to enabled will send webhook notifications, NEEDS `WEBHOOK_URL` | false | Boolean | | WEBHOOK_DEBUG_ENABLED | Set to enabled will enable feedback of curl and not use --silent | false | Boolean | | WEBHOOK_URL | Defines the url the webhook to send data to | | Url | diff --git a/includes/playerdetection.sh b/includes/playerdetection.sh index 30405e4..957df5c 100644 --- a/includes/playerdetection.sh +++ b/includes/playerdetection.sh @@ -52,7 +52,7 @@ announce_join() { send_player_join_notification "$message" fi if [[ -n $RCON_ENABLED ]] && [[ $RCON_ENABLED == "true" ]]; then - broadcast_player_join "$1" + broadcast_player_join "${1// /\-}" fi } @@ -65,6 +65,6 @@ announce_leave() { send_player_leave_notification "$message" fi if [[ -n $RCON_ENABLED ]] && [[ $RCON_ENABLED == "true" ]]; then - broadcast_player_leave "$1" + broadcast_player_leave "${1// /\-}" fi } \ No newline at end of file diff --git a/scripts/restart.sh b/scripts/restart.sh index 753b566..bd234f4 100644 --- a/scripts/restart.sh +++ b/scripts/restart.sh @@ -18,7 +18,11 @@ function schedule_restart() { time=$(date '+%H:%M:%S') rconcli "broadcast ${time}-AUTOMATIC-RESTART-IN-$counter-MINUTES" fi - sleep 60 + if [[ -n $RESTART_DEBUG_OVERRIDE ]] && [[ $RESTART_DEBUG_OVERRIDE == "true" ]]; then + sleep 1 + else + sleep 60 + fi done if [[ -n $RCON_ENABLED ]] && [[ $RCON_ENABLED == "true" ]]; then