Skip to content

Commit 52704b0

Browse files
committed
refine shutdown messages for clarity and remove redundant shutdown monitoring function
1 parent f9c3848 commit 52704b0

File tree

1 file changed

+6
-45
lines changed

1 file changed

+6
-45
lines changed

images/arkmanager/entrypoint.sh

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,12 @@ arkwarnshutdownminutes="5"
223223
arkwarnrestartminutes="5"
224224
arkwarnupdateminutes="5"
225225
226-
msgWarnUpdateMinutes="This ARK server will shutdown for an update in %d minutes"
227-
msgWarnUpdateSeconds="This ARK server will shutdown for an update in %d seconds"
228-
msgWarnRestartMinutes="This ARK server will shutdown for a restart in %d minutes"
229-
msgWarnRestartSeconds="This ARK server will shutdown for a restart in %d seconds"
230-
msgWarnShutdownMinutes="This ARK server will shutdown in %d minutes"
231-
msgWarnShutdownSeconds="This ARK server will shutdown in %d seconds"
226+
msgWarnUpdateMinutes="Survivors, a server update will begin in %d minute(s). Please prepare for shutdown."
227+
msgWarnUpdateSeconds="Survivors, a server update will begin in %d second(s). Brace for shutdown."
228+
msgWarnRestartMinutes="Heads up! Server restart in %d minute(s). Wrap up your activities."
229+
msgWarnRestartSeconds="Heads up! Server restart in %d second(s)."
230+
msgWarnShutdownMinutes="Warning: this ARK server will power down in %d minute(s)."
231+
msgWarnShutdownSeconds="Warning: this ARK server will power down in %d second(s)."
232232
233233
# ===============================================================================
234234
# PATHS AND LOGGING
@@ -433,41 +433,6 @@ monitor_server_status() {
433433
done
434434
}
435435

436-
# ===============================================================================
437-
# SHUTDOWN MONITORING
438-
# ===============================================================================
439-
440-
# Function to monitor for server shutdown message and exit container
441-
monitor_shutdown() {
442-
local log_file="/home/container/log/arkmanager.log"
443-
local check_interval=2 # Check every 2 seconds
444-
445-
# Wait a bit before starting to monitor
446-
sleep 5
447-
448-
while true; do
449-
# Check if log file exists and monitor for shutdown message
450-
if [[ -f "${log_file}" ]]; then
451-
if tail -n 20 "${log_file}" 2>/dev/null | grep -q "The server has been stopped"; then
452-
log_info "Server shutdown detected - stopping container"
453-
# Kill any background monitoring processes
454-
[[ -n "${STATUS_MONITOR_PID}" ]] && kill "${STATUS_MONITOR_PID}" 2>/dev/null
455-
[[ -n "${SHUTDOWN_MONITOR_PID}" ]] && kill "${SHUTDOWN_MONITOR_PID}" 2>/dev/null
456-
# Give processes a moment to clean up
457-
sleep 2
458-
# For Pelican Panel - kill all processes and exit
459-
pkill -f "ShooterGameServer" 2>/dev/null || true
460-
pkill -f "arkmanager" 2>/dev/null || true
461-
pkill -f "bash" 2>/dev/null || true
462-
# Force exit the entrypoint script
463-
kill -TERM $$ 2>/dev/null || kill -KILL $$ 2>/dev/null || exit 0
464-
fi
465-
fi
466-
467-
sleep ${check_interval}
468-
done
469-
}
470-
471436
# ===============================================================================
472437
# STARTUP EXECUTION
473438
# ===============================================================================
@@ -506,10 +471,6 @@ fi
506471

507472
log_server "Starting server with command: ${MODIFIED_STARTUP}"
508473

509-
# Start shutdown monitoring in background
510-
monitor_shutdown &
511-
SHUTDOWN_MONITOR_PID=$!
512-
513474
# Start server status monitoring in background
514475
monitor_server_status &
515476
STATUS_MONITOR_PID=$!

0 commit comments

Comments
 (0)