b408c8a95d
Runs authserver then worldserver from /root/azeroth-server/bin by default, kills existing instances, and uses nohup/disown so processes survive logout. Co-authored-by: Cursor <cursoragent@cursor.com>
50 lines
1.3 KiB
Bash
Executable File
50 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Start AzerothCore authserver + worldserver detached from the SSH session (nohup + disown).
|
|
# Stops any already-running authserver/worldserver processes first.
|
|
#
|
|
# Usage:
|
|
# sudo bash scripts/start-azeroth-servers.sh
|
|
# AZEROTH_BIN=/path/to/azeroth-server/bin bash scripts/start-azeroth-servers.sh
|
|
#
|
|
# Environment:
|
|
# AZEROTH_BIN — directory with authserver and worldserver (default: /root/azeroth-server/bin)
|
|
# AZEROTH_LOG_DIR — log directory (default: <parent of bin>/logs)
|
|
|
|
set -euo pipefail
|
|
|
|
BIN_DIR="${AZEROTH_BIN:-/root/azeroth-server/bin}"
|
|
LOG_DIR="${AZEROTH_LOG_DIR:-$(cd "$(dirname "$BIN_DIR")" && pwd)/logs}"
|
|
|
|
AUTH_BIN="${BIN_DIR}/authserver"
|
|
WORLD_BIN="${BIN_DIR}/worldserver"
|
|
|
|
if [[ ! -x "$AUTH_BIN" ]]; then
|
|
echo "error: not found or not executable: $AUTH_BIN" >&2
|
|
exit 1
|
|
fi
|
|
if [[ ! -x "$WORLD_BIN" ]]; then
|
|
echo "error: not found or not executable: $WORLD_BIN" >&2
|
|
exit 1
|
|
fi
|
|
|
|
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" >>"$LOG_DIR/authserver.log" 2>&1 &
|
|
disown || true
|
|
|
|
sleep 2
|
|
|
|
nohup "$WORLD_BIN" >>"$LOG_DIR/worldserver.log" 2>&1 &
|
|
disown || true
|
|
|
|
echo "Started authserver and worldserver (survives SSH disconnect)."
|
|
echo "Bin: $BIN_DIR"
|
|
echo "Logs: $LOG_DIR/authserver.log"
|
|
echo " $LOG_DIR/worldserver.log"
|