fix acc server container restarting

This commit is contained in:
2026-03-19 19:23:33 +01:00
parent c03234d339
commit 4441524447
4 changed files with 28 additions and 19 deletions

View File

@@ -1,7 +1,15 @@
#!/bin/bash
set -e
Xvfb :99 -screen 0 1024x768x16 &
# Use a display number derived from the server port to avoid conflicts
# between containers (each server gets its own unique display).
DISPLAY_NUM=$((SERVER_PORT % 1000 + 100))
export DISPLAY=:${DISPLAY_NUM}
# Clean up any stale X lock from a previous container run.
rm -f /tmp/.X${DISPLAY_NUM}-lock /tmp/.X11-unix/X${DISPLAY_NUM} 2>/dev/null || true
Xvfb ${DISPLAY} -screen 0 1024x768x16 -nolisten tcp &
XVFB_PID=$!
cleanup() {
@@ -10,7 +18,9 @@ cleanup() {
}
trap cleanup SIGTERM SIGINT
mkdir -p /acc/game/log
echo "Starting ACC server on port ${SERVER_PORT}..."
exec wine /acc/game/accServer.exe \
-port "${SERVER_PORT}"
cd /acc/game
exec wine /acc/game/accServer.exe