Daniel Gibbs před 10 roky
rodič
revize
d99a7e2b43

+ 1 - 1
functions/command_monitor.sh

@@ -83,7 +83,7 @@ fn_monitor_tmux(){
 		done
 		exit
 	else
-		fn_print_fail "Checking session: FAIL"
+		fn_print_fail "Checking session: "
 		fn_print_fail_eol_nl
 		fn_scriptlog "Checking session: FAIL"
 		fn_monitor_email_notification

+ 53 - 61
functions/command_start.sh

@@ -10,69 +10,63 @@ local modulename="Starting"
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 fn_start_teamspeak3(){
-check.sh
-info_ts3status.sh
+	check.sh
+	info_ts3status.sh
+
+	if [ "${ts3status}" != "Server is running" ]; then
+		# Will check for updates is updateonstart is yes
+		if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
+			update_check.sh
+		fi	
+	fi
 
-if [ "${ts3status}" != "Server is running" ]; then
-	# Will check for updates is updateonstart is yes
-	if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
-		update_check.sh
-	fi	
-fi
+	if [ ! -e "${servercfgfullpath}" ]; then
+		fn_print_warn_nl "${servercfgfullpath} is missing"
+		fn_scriptlog "${servercfgfullpath} is missing"
+		echo  "	* Creating blank ${servercfg}"
+		fn_scriptlog "Creating blank ${servercfg}"
+		sleep 2
+		echo  "	* ${servercfg} can remain blank by default."
+		fn_scriptlog "${servercfgfullpath} can remain blank by default."
+		sleep 2
+		echo  "	* ${servercfg} is located in ${servercfgfullpath}."
+		fn_scriptlog "${servercfg} is located in ${servercfgfullpath}."
+		sleep 5
+		touch "${servercfgfullpath}"
+	fi
 
-if [ ! -e "${servercfgfullpath}" ]; then
-	fn_print_warn "${servercfgfullpath} is missing"
-	fn_scriptlog "${servercfgfullpath} is missing"
-	sleep 2
-	echo -en "\n"
-	echo  "	* Creating blank ${servercfg}"
-	fn_scriptlog "Creating blank ${servercfg}"
-	sleep 2
-	echo  "	* ${servercfg} can remain blank by default."
-	fn_scriptlog "${servercfgfullpath} can remain blank by default."
-	sleep 2
-	echo  "	* ${servercfg} is located in ${servercfgfullpath}."
-	fn_scriptlog "${servercfg} is located in ${servercfgfullpath}."
-	sleep 5
-	touch "${servercfgfullpath}"
-fi
+	logs.sh
 
-logs.sh
+	fn_print_dots "${servername}"
+	fn_scriptlog "${servername}"
+	sleep 1
 
-fn_print_dots "${servername}"
-fn_scriptlog "${servername}"
-sleep 1
+	if [ "${ts3status}" == "Server is running" ]; then
+		fn_print_info_nl "${servername} is already running"
+		fn_scriptlog "${servername} is already running"
+		exit
+	fi
 
-if [ "${ts3status}" == "Server is running" ]; then
-	fn_print_info "${servername} is already running"
-	fn_scriptlog "${servername} is already running"
+	mv "${scriptlog}" "${scriptlogdate}"
+	# Create lock file
+	date > "${rootdir}/${lockselfname}"
+	cd "${executabledir}"
+	if [ "${ts3serverpass}" == "1" ];then
+		./ts3server_startscript.sh start serveradmin_password="${newpassword}" 
+	else
+		./ts3server_startscript.sh start inifile="${servercfgfullpath}" > /dev/null 2>&1
+	fi
 	sleep 1
-	echo -en "\n"
-	exit
-fi
-
-mv "${scriptlog}" "${scriptlogdate}"
-# Create lock file
-date > "${rootdir}/${lockselfname}"
-cd "${executabledir}"
-if [ "${ts3serverpass}" == "1" ];then
-	./ts3server_startscript.sh start serveradmin_password="${newpassword}" 
-else
-	./ts3server_startscript.sh start inifile="${servercfgfullpath}" > /dev/null 2>&1
-fi
-sleep 1
-info_ts3status.sh
-if [ "${ts3status}" = "Server seems to have died" ]||[ "${ts3status}"	= "No server running (ts3server.pid is missing)" ]; then
-	fn_print_fail_nl "Unable to start ${servername}"
-	fn_scriptlog "Unable to start ${servername}"
-	echo -e "	Check log files: ${rootdir}/log"
-	exit 1
-else
-	fn_print_ok "${servername}"
-	fn_scriptlog "Started ${servername}"
-fi
-sleep 0.5
-echo -en "\n"
+	info_ts3status.sh
+	if [ "${ts3status}" = "Server seems to have died" ]||[ "${ts3status}"	= "No server running (ts3server.pid is missing)" ]; then
+		fn_print_fail_nl "Unable to start ${servername}"
+		fn_scriptlog "Unable to start ${servername}"
+		echo -e "	Check log files: ${rootdir}/log"
+		exit 1
+	else
+		fn_print_ok_nl "${servername}"
+		fn_scriptlog "Started ${servername}"
+	fi
 }
 
 fn_start_tmux(){
@@ -139,13 +133,11 @@ if [ "${tmuxwc}" -eq 0 ]; then
 		echo ""
 		echo "Command"
 		echo "================================="
-		echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\""
-		echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\"" >> "${scriptlog}"
+		echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\"" | tee -a "${scriptlog}"
 		echo ""
 		echo "Error"
 		echo "================================="
-		cat "${scriptlogdir}/.${servicename}-tmux-error.tmp"
-		cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" >> "${scriptlog}"
+		cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" | tee -a "${scriptlog}"
 
 		# Detected error http://gameservermanagers.com/issues
 		if [ $(grep -c "Operation not permitted" "${scriptlogdir}/.${servicename}-tmux-error.tmp") ]; then

+ 1 - 1
functions/core_messages.sh

@@ -140,7 +140,7 @@ fn_print_error_nl(){
 	echo -e "\e[0;31mError!\e[0m $@"
 }
 
-# Info!
+# Infomation!
 fn_print_infomation(){
 	echo -en "\e[0;36mInfomation!\e[0m $@"
 }