Switch server scripts to tmux for panel console access

Rewrite start-azeroth-servers.sh to launch auth/worldserver in named
tmux sessions instead of nohup/disown. Add kill-azeroth-servers.sh to
tear down sessions and stray processes. Update vps-update-server.sh
with a --restart flag that stops servers before compile and restarts
them in tmux after.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Docker Build
2026-05-11 21:20:52 -05:00
parent a64279ed7e
commit fbd6ea47f2
3 changed files with 111 additions and 27 deletions
+32 -13
View File
@@ -1,14 +1,18 @@
#!/usr/bin/env bash
# Start AzerothCore authserver + worldserver detached from the SSH session (nohup + disown).
# Stops any already-running authserver/worldserver processes first.
# Start AzerothCore authserver + worldserver in named tmux sessions.
# Kills any already-running sessions first (acts as a restart).
#
# Usage:
# sudo bash scripts/start-azeroth-servers.sh
# AZEROTH_BIN=/path/to/azeroth-server/bin bash scripts/start-azeroth-servers.sh
# bash scripts/start-azeroth-servers.sh
# AZEROTH_BIN=/path/to/bin bash scripts/start-azeroth-servers.sh
#
# Environment:
# AZEROTH_BIN — directory with authserver and worldserver (default: /home/fractured-panel/azeroth-server/bin)
# AZEROTH_LOG_DIR — log directory (default: <parent of bin>/logs)
#
# tmux sessions:
# authserver — authserver console
# worldserver — worldserver console
set -euo pipefail
@@ -20,6 +24,14 @@ CONF_DIR="${BASE_DIR}/etc"
AUTH_BIN="${BIN_DIR}/authserver"
WORLD_BIN="${BIN_DIR}/worldserver"
AUTH_SESSION="authserver"
WORLD_SESSION="worldserver"
if ! command -v tmux &>/dev/null; then
echo "error: tmux is not installed" >&2
exit 1
fi
if [[ ! -x "$AUTH_BIN" ]]; then
echo "error: not found or not executable: $AUTH_BIN" >&2
exit 1
@@ -29,23 +41,30 @@ if [[ ! -x "$WORLD_BIN" ]]; then
exit 1
fi
mkdir -p "$LOG_DIR"
# Tear down existing sessions (ignore errors if they don't exist)
tmux kill-session -t "$AUTH_SESSION" 2>/dev/null || true
tmux kill-session -t "$WORLD_SESSION" 2>/dev/null || true
# Also kill any stray processes not managed by tmux
pkill -x authserver 2>/dev/null || true
pkill -x worldserver 2>/dev/null || true
sleep 1
mkdir -p "$LOG_DIR"
cd "$BIN_DIR"
nohup "$AUTH_BIN" -c "${CONF_DIR}/authserver.conf" >>"$LOG_DIR/authserver.log" 2>&1 &
disown || true
# Launch authserver in a tmux session
tmux new-session -d -s "$AUTH_SESSION" -c "$BIN_DIR" \
"$AUTH_BIN -c ${CONF_DIR}/authserver.conf 2>&1 | tee -a ${LOG_DIR}/authserver.log"
sleep 2
nohup "$WORLD_BIN" -c "${CONF_DIR}/worldserver.conf" >>"$LOG_DIR/worldserver.log" 2>&1 &
disown || true
# Launch worldserver in a tmux session
tmux new-session -d -s "$WORLD_SESSION" -c "$BIN_DIR" \
"$WORLD_BIN -c ${CONF_DIR}/worldserver.conf 2>&1 | tee -a ${LOG_DIR}/worldserver.log"
echo "Started authserver and worldserver (survives SSH disconnect)."
echo "Started servers in tmux sessions."
echo " tmux attach -t $AUTH_SESSION — authserver console"
echo " tmux attach -t $WORLD_SESSION — worldserver console"
echo "Bin: $BIN_DIR"
echo "Config: $CONF_DIR"
echo "Logs: $LOG_DIR/authserver.log"