mirror of
https://github.com/hermensbas/azerothcore_installer.git
synced 2026-01-13 00:28:33 +00:00
Update 6_server-start.sh
This commit is contained in:
@@ -20,6 +20,11 @@ AUTH_LOG="$LOGS_PATH/authserver_$TIMESTAMP.log"
|
||||
WORLD_LOG="$LOGS_PATH/worldserver_$TIMESTAMP.log"
|
||||
WORLD_CRASH_LOG="$CRASHES_PATH/worldserver_gdb_$TIMESTAMP.log"
|
||||
|
||||
##########################################################################################
|
||||
# Determine SERVER_ROOT based on script location (works with aliases)
|
||||
##########################################################################################
|
||||
SERVER_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
##########################################################################################
|
||||
# Check debug toggle
|
||||
##########################################################################################
|
||||
@@ -36,6 +41,7 @@ start_tmux_session() {
|
||||
local command=$2
|
||||
local log_file=$3
|
||||
|
||||
# Create session if it doesn't exist
|
||||
if tmux has-session -t "$session_name" 2>/dev/null; then
|
||||
echo "Tmux session '$session_name' already exists."
|
||||
else
|
||||
@@ -47,7 +53,10 @@ start_tmux_session() {
|
||||
fi
|
||||
fi
|
||||
|
||||
# Export environment variables inside tmux
|
||||
tmux send-keys -t "$session_name" "export LOGS_PATH=$LOGS_PATH; export CRASHES_PATH=$CRASHES_PATH" C-m
|
||||
|
||||
# Run the command and pipe output to a **new log file**
|
||||
tmux send-keys -t "$session_name" "$command | tee $log_file" C-m
|
||||
|
||||
echo "Running '$command' in $session_name, logging to $log_file"
|
||||
@@ -57,21 +66,26 @@ start_tmux_session() {
|
||||
##########################################################################################
|
||||
# Prepare commands
|
||||
##########################################################################################
|
||||
SERVER_ROOT="$(pwd)"
|
||||
|
||||
# Authserver always via acore.sh for auto-restart
|
||||
AUTH_CMD="${SERVER_ROOT}/acore.sh run-authserver"
|
||||
|
||||
if [[ $DEBUG_MODE -eq 1 ]]; then
|
||||
echo "DEBUG MODE: Running worldserver under GDB"
|
||||
WORLD_CMD="gdb -ex 'set logging file $WORLD_CRASH_LOG' \
|
||||
-ex 'set logging enabled on' \
|
||||
-ex 'run' \
|
||||
-ex 'bt full' \
|
||||
-ex 'quit' \
|
||||
--args ${SERVER_ROOT}/env/dist/bin/worldserver"
|
||||
WORLD_CMD="run-engine restart worldserver \
|
||||
--bin-path ${SERVER_ROOT}/env/dist/bin \
|
||||
--server-config ${SERVER_ROOT}/conf/worldserver.conf \
|
||||
--session-manager tmux \
|
||||
--gdb-enabled 1 \
|
||||
--logs-path $LOGS_PATH \
|
||||
--crashes-path $CRASHES_PATH"
|
||||
else
|
||||
WORLD_CMD="${SERVER_ROOT}/acore.sh run-worldserver"
|
||||
WORLD_CMD="run-engine restart worldserver \
|
||||
--bin-path ${SERVER_ROOT}/env/dist/bin \
|
||||
--server-config ${SERVER_ROOT}/conf/worldserver.conf \
|
||||
--session-manager tmux \
|
||||
--logs-path $LOGS_PATH \
|
||||
--crashes-path $CRASHES_PATH"
|
||||
fi
|
||||
|
||||
##########################################################################################
|
||||
@@ -83,6 +97,6 @@ start_tmux_session "$WORLDSERVER_SESSION" "$WORLD_CMD" "$WORLD_LOG"
|
||||
##########################################################################################
|
||||
# Optional: show menu if exists
|
||||
##########################################################################################
|
||||
if [[ -f "${ROOT_DIR}/script/menu.sh" ]]; then
|
||||
source "${ROOT_DIR}/script/menu.sh"
|
||||
if [[ -f "${SERVER_ROOT}/script/menu.sh" ]]; then
|
||||
source "${SERVER_ROOT}/script/menu.sh"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user