Kaynağa Gözat

Improved Tmux error reporting.

Daniel Gibbs 11 yıl önce
ebeveyn
işleme
c8a5f9b792
2 değiştirilmiş dosya ile 18 ekleme ve 18 silme
  1. 2 2
      functions/fn_check_tmux
  2. 16 16
      functions/fn_start

+ 2 - 2
functions/fn_check_tmux

@@ -6,7 +6,7 @@
 
 # Checks if tmux is installed as too many users do not RTFM or know how to use Google.
 
-if [ "$(command -v tmux)" ]||[ "$(which tmux)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then
+if [ "$(command -v tmux)" ]||[ "$(which tmux >/dev/null 2>&1)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then
 	:
 else
 	fn_printfailnl "Tmux not installed"
@@ -15,6 +15,6 @@ else
 	echo "	* Tmux is required to run this server."
 	# Suitable passive agressive message
 	echo "	* Please see the the following link."
-	echo "  * http://gameservermanagers.com/tmux"
+	echo "	* http://gameservermanagers.com/tmux"
 	exit
 fi

+ 16 - 16
functions/fn_start

@@ -2,7 +2,7 @@
 # LGSM fn_start function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-# Version: 220415
+# Version: 070515
 
 # Description: Starts the server.
 
@@ -119,26 +119,33 @@ else
 fi
 sleep 1
 tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
-
 # If the server fails to start
 if [ "${tmuxwc}" -eq 0 ]; then
 	fn_printfail "Unable to start ${servername}"
 	fn_scriptlog "Unable to start ${servername}"
 	sleep 1
 	if [ -s "${scriptlogdir}/.${servicename}-tmux-error.tmp" ]; then
-		fn_printfail "Unable to start ${servername}: Tmux returned the following error:"
-		fn_scriptlog "tmux returned the following error"
+		fn_printfail "Unable to start ${servername}: Tmux error:"
+		fn_scriptlog "Tmux error"
 		sleep 1
 		echo -en "\n"
 		echo ""
+		echo "Command"
+		echo "================================="
+		echo "tmux new-session -d -s ${servicename} "${executable} ${parms}""
+		echo "tmux new-session -d -s ${servicename} "${executable} ${parms}"" >> "${scriptlog}"
+		echo ""
+		echo "Error"
+		echo "================================="
 		cat "${scriptlogdir}/.${servicename}-tmux-error.tmp"
 		cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" >> "${scriptlog}"
-		sleep 1
-		echo ""
+
 		# Detected error http://gameservermanagers.com/issues
 		if [ $(grep -c "Operation not permitted" "${scriptlogdir}/.${servicename}-tmux-error.tmp") ];then
+		echo ""
+		echo "Fix"
+		echo "================================="
 			if [ ! $(grep "tty:" /etc/group|grep "$(whoami)") ];then
-				echo "================================="
 				echo "$(whoami) is not part of the tty group."
 				fn_scriptlog "$(whoami) is not part of the tty group."
 				group=$(grep tty /etc/group)
@@ -152,16 +159,9 @@ if [ "${tmuxwc}" -eq 0 ]; then
 				echo ""
 				echo "http://gameservermanagers.com/tmux-op-perm"
 				fn_scriptlog "http://gameservermanagers.com/tmux-op-perm"
-				echo "================================="
 			else
-				echo "$(whoami) is part of the tty group."
-				group=$(grep tty /etc/group)
-				echo ""
-				echo "	${group}"
-				fn_scriptlog "${group}"
-				echo ""
-				echo "No known fix currently."
-				fn_scriptlog "No known fix currently."
+				echo "No known fix currently. Please log an issue."
+				fn_scriptlog "No known fix currently. Please log an issue."
 				echo "http://gameservermanagers.com/issues"
 				fn_scriptlog "http://gameservermanagers.com/issues"
 			fi