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
+42 -14
View File
@@ -6,24 +6,25 @@
# (see docs/DEPLOY_LINUX_VPS.md).
#
# What this does:
# 1. git pull on the current branch (optional; can skip)
# 2. ./acore.sh compiler build — or compiler all for a full clean rebuild
# 1. Optionally kill running servers (tmux sessions)
# 2. git pull on the current branch (optional; can skip)
# 3. ./acore.sh compiler build — or compiler all for a full clean rebuild
# 4. Optionally restart servers in tmux sessions
#
# Database migrations from data/sql/updates/ run when you next start worldserver/authserver
# (Updates.* / SourceDirectory in *.conf). This script does not start or stop daemons unless
# you pass --run-after or set FRACTURED_POST_UPDATE_CMD.
# (Updates.* / SourceDirectory in *.conf).
#
# Usage:
# bash scripts/vps-update-server.sh
# bash scripts/vps-update-server.sh --full
# bash scripts/vps-update-server.sh --no-pull
# bash scripts/vps-update-server.sh # pull + compile only
# bash scripts/vps-update-server.sh --restart # pull + compile + restart servers in tmux
# bash scripts/vps-update-server.sh --full --restart # clean rebuild + restart
# bash scripts/vps-update-server.sh --no-pull --restart # compile current tree + restart
# bash scripts/vps-update-server.sh --dry-run
# FRACTURED_POST_UPDATE_CMD='sudo systemctl restart fractured-world' bash scripts/vps-update-server.sh --run-after
# bash scripts/vps-update-server.sh --run-after 'sudo systemctl restart fractured-world'
# bash scripts/vps-update-server.sh --run-after 'custom command here'
#
# Environment:
# FRACTURED_GIT_REMOTE — remote name (default: origin)
# FRACTURED_POST_UPDATE_CMD — shell command run after a successful compile (if --run-after is passed without an argument, this is used)
# FRACTURED_GIT_REMOTE — remote name (default: origin)
# FRACTURED_POST_UPDATE_CMD — shell command run after compile (used by bare --run-after)
set -euo pipefail
@@ -35,6 +36,7 @@ FULL_BUILD=0
COMPILE_ONLY=0
DRY_RUN=0
DO_RUN_AFTER=0
DO_RESTART=0
INSTALL_PREFIX=""
POST_UPDATE_CMD="${FRACTURED_POST_UPDATE_CMD:-}"
GIT_REMOTE="${FRACTURED_GIT_REMOTE:-origin}"
@@ -52,8 +54,9 @@ Options:
--compile-only ./acore.sh compiler compile (incremental).
--prefix PATH Override CMAKE_INSTALL_PREFIX (updates conf/config.sh BINPATH).
--dry-run Print commands without running them.
--run-after [CMD] Run shell command after successful compile. If CMD is omitted,
uses FRACTURED_POST_UPDATE_CMD from the environment.
--restart Kill servers before compile, restart in tmux after.
--run-after [CMD] Run a custom shell command after successful compile.
If CMD is omitted, uses FRACTURED_POST_UPDATE_CMD.
Environment:
FRACTURED_GIT_REMOTE Git remote (default: origin).
@@ -102,6 +105,10 @@ while [[ $# -gt 0 ]]; do
DRY_RUN=1
shift
;;
--restart)
DO_RESTART=1
shift
;;
--run-after)
DO_RUN_AFTER=1
shift
@@ -140,6 +147,18 @@ fi
cd "$ROOT"
KILL_SCRIPT="${SCRIPT_DIR}/kill-azeroth-servers.sh"
START_SCRIPT="${SCRIPT_DIR}/start-azeroth-servers.sh"
if [[ "$DO_RESTART" -eq 1 ]]; then
if [[ ! -f "$KILL_SCRIPT" || ! -f "$START_SCRIPT" ]]; then
echo "error: --restart requires kill-azeroth-servers.sh and start-azeroth-servers.sh in scripts/" >&2
exit 1
fi
echo "==> stopping servers before compile"
run bash "$KILL_SCRIPT"
fi
if [[ -n "$INSTALL_PREFIX" ]]; then
echo "==> updating conf/config.sh BINPATH to: $INSTALL_PREFIX"
if grep -q '^BINPATH=' conf/config.sh; then
@@ -189,6 +208,11 @@ else
run ./acore.sh compiler build
fi
if [[ "$DO_RESTART" -eq 1 ]]; then
echo "==> restarting servers in tmux sessions"
run bash "$START_SCRIPT"
fi
if [[ "$DO_RUN_AFTER" -eq 1 ]]; then
echo "==> post-update: $POST_UPDATE_CMD"
if [[ "$DRY_RUN" -eq 1 ]]; then
@@ -199,4 +223,8 @@ if [[ "$DO_RUN_AFTER" -eq 1 ]]; then
fi
fi
echo "Done. Restart authserver/worldserver (or your service manager) when ready so new binaries and SQL updates apply."
if [[ "$DO_RESTART" -eq 0 && "$DO_RUN_AFTER" -eq 0 ]]; then
echo "Done. Run 'bash scripts/start-azeroth-servers.sh' to (re)start servers in tmux."
else
echo "Done."
fi