added check for the session before attempting to connect to avoid exiting the script

This commit is contained in:
CerberusV1
2024-10-16 15:33:04 +02:00
parent 679efd7b54
commit 73bb7b7f18

View File

@@ -76,12 +76,13 @@ while true; do
clear clear
echo " Connecting to Server" echo " Connecting to Server"
echo "------------------------------------------------------------" echo "------------------------------------------------------------"
# Add a chck before connecting to the session if the session already exists if tmux has-session -t ${server_name} 2>/dev/null; then
# if not promt the user to start it manually # Attaches to the running tmux session of the server if the session exists
# ----------------------------------------------------------------------------- tmux a -t "${server_name}"
# Attaches to the running tmux session of the server if the session exists else
tmux a -t "${server_name}" echo "You need to start the server before trying to connect to it."
read -p "Press Enter to continue..." read -p "Press Enter to continue..."
fi
break break
;; ;;
"Set EULA") "Set EULA")