Daniel Gibbs пре 10 година
родитељ
комит
fe86ab76d6

+ 3 - 3
lgsm/functions/check_steamcmd.sh

@@ -30,7 +30,7 @@ fn_check_steamcmd_user(){
 	fi
 	# Anonymous user is set if steamuser is missing
 	if [ -z "${steamuser}" ]; then
-		fn_print_warn_nl "Steam login not set. Using anonymous login."
+		fn_print_error_nl "Steam login not set. Using anonymous login."
 		if [ -d "${scriptlogdir}" ]; then
 			fn_script_log_error "Steam login not set. Using anonymous login."
 		fi
@@ -48,8 +48,8 @@ fn_check_steamcmd_sh(){
 		if [ "${selfname}" == "command_install.sh" ]; then
 			fn_install_steamcmd
 		else
-			fn_print_warn_nl "SteamCMD is missing"
-			fn_script_log_warn "SteamCMD is missing"
+			fn_print_error_nl "SteamCMD is missing"
+			fn_script_log_error "SteamCMD is missing"
 			sleep 1
 			fn_install_steamcmd
 		fi

+ 1 - 1
lgsm/functions/command_console.sh

@@ -35,7 +35,7 @@ if [ "${status}" != "0" ]; then
 	fn_print_ok_nl "Closing console"
 	fn_script_log_info "Console closed"
 else
-	fn_print_fail_nl "Server not running"
+	fn_print_error_nl "Server not running"
 	fn_script_log_error "Failed to access: Server not running"
 	sleep 1
 	while true; do

+ 1 - 1
lgsm/functions/command_debug.sh

@@ -15,7 +15,7 @@ fn_lockfile_trap(){
 	# resets terminal. Servers can sometimes mess up the terminal on exit.
 	reset
 	fn_print_ok_nl "Closing debug"
-	fn_script_log_info "Debug closed"
+	fn_script_log_pass "Debug closed"
 	core_exit.sh
 }
 

+ 6 - 6
lgsm/functions/command_monitor.sh

@@ -12,8 +12,8 @@ local selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 fn_monitor_check_lockfile(){
 	# Monitor does not run it lockfile is not found
 	if [ ! -f "${rootdir}/${lockselfname}" ]; then
-		fn_print_info_nl "Disabled: No lock file found"
-		fn_script_log_info "Disabled: No lock file found"
+		fn_print_error_nl "Disabled: No lock file found"
+		fn_script_log_error "Disabled: No lock file found"
 		echo "	* To enable monitor run ./${selfname} start"
 		core_exit.sh
 	fi
@@ -22,8 +22,8 @@ fn_monitor_check_lockfile(){
 fn_monitor_check_update(){
 	# Monitor will not check if update is running.
 	if [ "$(ps -ef|grep "${selfname} update"|grep -v grep|wc -l)" != "0" ]; then
-		fn_print_info_nl "SteamCMD is currently checking for updates"
-		fn_script_log_info "SteamCMD is currently checking for updates"
+		fn_print_error_nl "SteamCMD is currently checking for updates"
+		fn_script_log_error "SteamCMD is currently checking for updates"
 		sleep 1
 		core_exit.sh
 	fi
@@ -42,7 +42,7 @@ fn_monitor_teamspeak3(){
 		fn_print_ok_eol_nl
 		fn_script_log_pass "Checking session: OK"
 	else
-		fn_print_fail "Checking session: ${ts3error}: "
+		fn_print_error "Checking session: ${ts3error}: "
 		fn_print_fail_eol_nl
 		fn_script_log_error "Checking session: ${ts3error}: FAIL"
 		failurereason="${ts3error}"
@@ -69,7 +69,7 @@ fn_monitor_tmux(){
 			fi
 		done
 	else
-		fn_print_fail "Checking session: "
+		fn_print_error "Checking session: "
 		fn_print_fail_eol_nl
 		fn_script_log_error "Checking session: FAIL"
 		alert="restart"

+ 20 - 18
lgsm/functions/command_stop.sh

@@ -28,9 +28,9 @@ fn_stop_graceful_source(){
 	done
 	check_status.sh
 	if [ "${status}" != "0" ]; then
-		fn_print_fail "Graceful: rcon quit: "
+		fn_print_error "Graceful: rcon quit: "
 		fn_print_fail_eol_nl
-		fn_script_log_fail "Graceful: rcon quit: FAIL"
+		fn_script_log_error "Graceful: rcon quit: FAIL"
 	fi
 	sleep 1
 	fn_stop_tmux
@@ -94,9 +94,9 @@ fn_stop_graceful_sdtd(){
 			completed=$(echo -en "\n ${sdtd_telnet_shutdown}"|grep "Completed.")
 			refused=$(echo -en "\n ${sdtd_telnet_shutdown}"|grep "Timeout or EOF")
 			if [ -n "${refused}" ]; then
-				fn_print_warn "Graceful: telnet: ${telnetip}: "
+				fn_print_error "Graceful: telnet: ${telnetip}: "
 				fn_print_fail_eol_nl
-				fn_script_log_warn "Graceful: telnet: ${telnetip}: FAIL"
+				fn_script_log_error "Graceful: telnet: ${telnetip}: FAIL"
 				sleep 1
 			elif [ -n "${completed}" ]; then
 				break
@@ -122,12 +122,12 @@ fn_stop_graceful_sdtd(){
 		# If cannot shutdown correctly world save may be lost
 		else
 			if [ -n "${refused}" ]; then
-				fn_print_fail "Graceful: telnet: "
+				fn_print_error "Graceful: telnet: "
 				fn_print_fail_eol_nl
-				fn_script_log_fail "Graceful: telnet: ${telnetip}: FAIL"
+				fn_script_log_error "Graceful: telnet: ${telnetip}: FAIL"
 			else
-				fn_print_fail_nl "Graceful: telnet: Unknown error"
-				fn_script_log_fail "Graceful: telnet: Unknown error"
+				fn_print_error_nl "Graceful: telnet: Unknown error"
+				fn_script_log_error "Graceful: telnet: Unknown error"
 			fi
 			echo -en "\n" | tee -a "${scriptlog}"
 			echo -en "Telnet output:" | tee -a "${scriptlog}"
@@ -135,9 +135,9 @@ fn_stop_graceful_sdtd(){
 			echo -en "\n\n" | tee -a "${scriptlog}"
 		fi
 	else
-		fn_print_fail "Graceful: telnet: expect not installed: "
+		fn_print_warn "Graceful: telnet: expect not installed: "
 		fn_print_fail_eol_nl
-		fn_script_log_fail "Graceful: telnet: expect not installed: FAIL"
+		fn_script_log_warn "Graceful: telnet: expect not installed: FAIL"
 	fi
 	sleep 1
 	fn_stop_tmux
@@ -159,13 +159,15 @@ fn_stop_ark(){
 		maxpiditer=15 # The maximum number of times to check if the ark pid has closed gracefully.
 		info_config.sh
 		if [ -z "${queryport}" ]; then
-				fn_print_warn "no queryport found using info_config.sh"
+				fn_print_warn "No queryport found using info_config.sh"
+				fn_script_log_warn "No queryport found using info_config.sh"
 				userconfigfile="${filesdir}"
 				userconfigfile+="/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini"
 				queryport=$(grep ^QueryPort= ${userconfigfile} | cut -d= -f2 | sed "s/[^[:digit:].*].*//g")
 		fi
 		if [ -z "${queryport}" ]; then
-				fn_print_warn "no queryport found in the GameUsersettings.ini file"
+				fn_print_warn "No queryport found in the GameUsersettings.ini file"
+				fn_script_log_warn "No queryport found in the GameUsersettings.ini file"
 				return
 		fi
 
@@ -178,8 +180,8 @@ fn_stop_ark(){
 						# check for a valid pid
 						let pid+=0 # turns an empty string into a valid number, '0',
 						# and a valid numeric pid remains unchanged.
-						if [[ $pid -gt 1 && $pid -le $(cat /proc/sys/kernel/pid_max) ]] ; then
-						fn_print_dots "Process still bound. Awaiting graceful exit: $pidcheck"
+						if [[ ${pid} -gt 1 && $pid -le $(cat /proc/sys/kernel/pid_max) ]] ; then
+						fn_print_dots "Process still bound. Awaiting graceful exit: ${pidcheck}"
 								sleep 1
 						else
 								break # Our job is done here
@@ -188,7 +190,7 @@ fn_stop_ark(){
 				if [[ ${pidcheck} -eq ${maxpiditer} ]] ; then
 						# The process doesn't want to close after 20 seconds.
 						# kill it hard.
-						fn_print_warn "Terminating reluctant Ark process: $pid"
+						fn_print_error "Terminating reluctant Ark process: ${pid}"
 						kill -9 $pid
 				fi
 		fi # end if for port check
@@ -205,8 +207,8 @@ fn_stop_teamspeak3(){
 		fn_print_ok_nl "${servername}"
 		fn_script_log_pass "Stopped ${servername}"
 	else
-		fn_print_fail_nl "Unable to stop${servername}"
-		fn_script_log_fail "Unable to stop${servername}"
+		fn_print_fail_nl "Unable to stop ${servername}"
+		fn_script_log_fail "Unable to stop ${servername}"
 	fi
 }
 
@@ -231,7 +233,7 @@ fn_stop_tmux(){
 		fn_script_log_pass "Stopped ${servername}"
 	else
 		fn_print_fail_nl "Unable to stop${servername}"
-		fn_script_log_error "Unable to stop${servername}"
+		fn_script_log_fatal "Unable to stop${servername}"
 	fi
 }
 

+ 14 - 8
lgsm/functions/command_validate.sh

@@ -9,12 +9,12 @@ local commandaction="Validate"
 local selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 fn_validation(){
-	fn_print_warn_nl "Validating may overwrite some customised files."
-	echo -en "https://developer.valvesoftware.com/wiki/SteamCMD#Validate"
-	sleep 5
+	echp -e "	* Validating may overwrite some customised files."
+	echo -en "	* https://developer.valvesoftware.com/wiki/SteamCMD#Validate"
+	sleep 3
 	echo -en "\n"
-	fn_print_ok "Checking server files"
-	fn_script_log_info "Checking server files"
+	fn_print_dots "Validating files: SteamCMD"
+	fn_script_log_info "Validating files: SteamCMD"
 	sleep 1
 
 	cd "${rootdir}/steamcmd"
@@ -28,12 +28,18 @@ fn_validation(){
 	else
 		${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" validate +quit| tee -a "${scriptlog}"
 	fi
-
+	if [ $? =! 0 ]; then
+		fn_print_fail "Validating files: SteamCMD"
+		fn_script_log_fatal "Validating files: SteamCMD: FAIL"
+	else
+		fn_print_ok "Validating files: SteamCMD"
+		fn_script_log_pass "Validating files: SteamCMD: OK"
+	fi
 	fix.sh
-	fn_script_log_info "Checking complete"
+
 }
 
-fn_print_dots "Checking server files"
+fn_print_dots "Validating files"
 sleep 1
 check.sh
 check_status.sh

+ 2 - 2
lgsm/functions/core_dl.sh

@@ -33,7 +33,7 @@ fn_dl_md5(){
 			fn_script_log_fatal "Verifying ${filename} with MD5: FAIL"
 			fn_script_log_info "${filename} returned MD5 checksum: ${md5sumcmd}"
 			fn_script_log_info "Expected MD5 checksum: ${md5}"
-			exit 1
+			core_exit.sh
 		else
 			fn_print_ok_eol_nl
 			fn_script_log_pass "Verifying ${filename} with MD5: OK"
@@ -147,7 +147,7 @@ fn_fetch_file(){
 			if [ -f "${scriptlog}" ]; then
 				fn_script_log_fatal "Curl is not installed!"
 			fi
-			exit 1
+			core_exit.sh
 		fi
 		# make file executecmd if executecmd is set
 		if [ "${executecmd}" == "executecmd" ]; then

+ 1 - 1
lgsm/functions/core_messages.sh

@@ -17,7 +17,7 @@ if [ "${ansi}" != "off" ]; then
 	magenta="\e[35m"
 	cyan="\e[36m"
 	lightyellow="\e[93m"
-	# carriage return & Erase to end of line:
+	# carriage return & erase to end of line
 	creeol="\r\033[K"
 fi
 

+ 1 - 1
lgsm/functions/fix.sh

@@ -21,7 +21,7 @@ fn_fix_msg_start(){
 
 fn_fix_msg_end(){
 	if [ $? -ne 0 ]; then
-		fn_print_fail_nl "Applying ${fixname} fix: ${gamename}"
+		fn_print_error_nl "Applying ${fixname} fix: ${gamename}"
 		fn_script_log_error "Applying ${fixname} fix: ${gamename}"
 		exitcode=2
 	else

+ 8 - 8
lgsm/functions/update_steamcmd.sh

@@ -12,9 +12,9 @@ fn_update_steamcmd_dl(){
 
 	check.sh
 	info_config.sh
-	fn_print_dots "Starting SteamCMD"
+	fn_print_dots "SteamCMD"
 	sleep 1
-	fn_print_ok_nl "Starting SteamCMD"
+	fn_print_ok_nl "SteamCMD"
 	fn_script_log_info "Starting SteamCMD"
 
 	cd "${rootdir}/steamcmd"
@@ -44,8 +44,8 @@ fn_appmanifest_check(){
 	# This error is corrected if required.
 	if [ "${appmanifestfilewc}" -ge "2" ]; then
 		sleep 1
-		fn_print_warn "Multiple appmanifest_${appid}.acf files found"
-		fn_script_log_warn "Multiple appmanifest_${appid}.acf files found"
+		fn_print_error "Multiple appmanifest_${appid}.acf files found"
+		fn_script_log_error "Multiple appmanifest_${appid}.acf files found"
 		sleep 2
 		fn_print_dots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files"
 		sleep 1
@@ -68,8 +68,8 @@ fn_appmanifest_check(){
 			fn_print_ok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
 			fn_script_log_pass "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
 			sleep 1
-			fn_print_warn_nl "Forcing update to correct issue"
-			fn_script_log_warn "Forcing update to correct issue"
+			fn_print_info_nl "Forcing update to correct issue"
+			fn_script_log_info "Forcing update to correct issue"
 			sleep 1
 			update_dl.sh
 			update_check.sh
@@ -81,8 +81,8 @@ fn_appmanifest_check(){
 			core_exit.sh
 		fi
 		forceupdate=1
-		fn_print_warn "No appmanifest_${appid}.acf found"
-		fn_script_log_warn "No appmanifest_${appid}.acf found"
+		fn_print_error "No appmanifest_${appid}.acf found"
+		fn_script_log_error "No appmanifest_${appid}.acf found"
 		sleep 1
 		fn_print_info_nl "Forcing update to correct issue"
 		fn_script_log_info "Forcing update to correct issue"

+ 4 - 4
lgsm/functions/update_ts3.sh

@@ -29,13 +29,13 @@ fn_update_ts3_currentbuild(){
 	# Gets currentbuild info
 	# Checks currentbuild info is available, if fails a server restart will be forced to generate logs.
 	if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then
-		fn_print_fail "Checking for update: teamspeak.com"
+		fn_print_error "Checking for update: teamspeak.com"
 		sleep 1
-		fn_print_fail_nl "Checking for update: teamspeak.com: No logs with server version found"
-		fn_script_log_warn "Checking for update: teamspeak.com: No logs with server version found"
+		fn_print_error_nl "Checking for update: teamspeak.com: No logs with server version found"
+		fn_script_log_error "Checking for update: teamspeak.com: No logs with server version found"
 		sleep 2
 		fn_print_info_nl "Checking for update: teamspeak.com: Forcing server restart"
-		fn_script_log_warn "Checking for update: teamspeak.com: Forcing server restart"
+		fn_script_log_info "Checking for update: teamspeak.com: Forcing server restart"
 		sleep 2
 		exitbypass=1
 		command_stop.sh