Преглед изворни кода

Merge remote-tracking branch 'refs/remotes/origin/master' into mumble-git-dl

# Conflicts:
#	lgsm/functions/info_config.sh
Daniel Gibbs пре 9 година
родитељ
комит
ddc063c09b

+ 8 - 0
lgsm/functions/check.sh

@@ -83,3 +83,11 @@ do
 		check_status.sh
 		check_status.sh
 	fi
 	fi
 done
 done
+
+local allowed_commands_array=( command_install.sh command_start.sh command_debug.sh )
+for allowed_command in "${allowed_commands_array[@]}"
+do
+	if [ "${allowed_command}" == "${function_selfname}" ]; then
+		check_system_requirements.sh
+	fi
+done

+ 20 - 1
lgsm/functions/check_config.sh

@@ -17,4 +17,23 @@ if [ ! -e "${servercfgfullpath}" ]; then
 		fn_script_log_warn "${servercfgfullpath}"
 		fn_script_log_warn "${servercfgfullpath}"
 		sleep 2
 		sleep 2
 	fi
 	fi
-fi
+fi
+
+if [ "${gamename}" == "Rust" ]; then
+	if  [ -z "${rconpassword}" ]; then
+		fn_print_dots ""
+		sleep 0.5
+		fn_print_fail_nl "RCON password is not set!"
+		echo "  * Not setting an RCON password causes issues with ${gamename}"
+		fn_script_log_fatal "RCON password is not set"
+		fn_script_log_fatal "Not setting an RCON password causes issues with ${gamename}"
+		core_exit.sh
+	elif [ "${rconpassword}" == "CHANGE_ME" ]; then
+		fn_print_dots ""
+		sleep 0.5
+		fn_print_warn_nl "Default RCON Password detected!"
+		echo " * Having ${rconpassword} as a password is not very safe."
+		fn_script_log_warn "Default RCON Password detected"
+		sleep 2
+	fi
+fi

+ 28 - 0
lgsm/functions/check_system_requirements.sh

@@ -0,0 +1,28 @@
+#!/bin/bash
+# LGSM check_system_requirements.sh
+# Author: Daniel Gibbs
+# Contributor: UltimateByte
+# Website: https://gameservermanagers.com
+# Description: Checks RAM requirements
+
+local commandname="CHECK"
+local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+info_distro.sh
+
+# RAM requirements in megabytes for each game or engine.
+if [ "${gamename}" == "Rust" ]; then
+	ramrequirementmb="4000"
+	ramrequirementgb="4"
+fi
+
+# If the game or engine has a minimum RAM Requirement, compare it to system's available RAM.
+if [ -n "${ramrequirement}" ]; then
+	if [ "${physmemtotalmb}" -lt "${ramrequirementmb}" ]; then
+		# Warn the user
+		fn_print_warn "Insufficient memory: ${ramrequirementgb}G required, ${physmemtotal} available"
+		sleep 1
+		fn_print_warning "You may experiance poor performance from your server"
+		sleep 1
+	fi
+fi

+ 4 - 4
lgsm/functions/command_details.sh

@@ -43,8 +43,8 @@ fn_details_performance(){
 	# Uptime:    55d, 3h, 38m
 	# Uptime:    55d, 3h, 38m
 	# Avg Load:  1.00, 1.01, 0.78
 	# Avg Load:  1.00, 1.01, 0.78
 	#
 	#
-	# Mem:       total   used   free
-	# Physical:  741M    656M   85M
+	# Mem:       total   used   free  cached
+	# Physical:  741M    656M   85M   256M 
 	# Swap:      0B      0B     0B
 	# Swap:      0B      0B     0B
 
 
 	echo -e ""
 	echo -e ""
@@ -56,8 +56,8 @@ fn_details_performance(){
 	} | column -s $'\t' -t
 	} | column -s $'\t' -t
 	echo -e ""
 	echo -e ""
 	{
 	{
-		echo -e "${blue}Mem:\t${blue}total\t used\t free${default}"
-		echo -e "${blue}Physical:\t${default}${physmemtotal}\t${physmemused}\t${physmemfree}${default}"
+		echo -e "${blue}Mem:\t${blue}total\t used\t free\t cached${default}"
+		echo -e "${blue}Physical:\t${default}${physmemtotal}\t${physmemused}\t${physmemfree}\t${physmemcached}${default}"
 		echo -e "${blue}Swap:\t${default}${swaptotal}\t${swapused}\t${swapfree}${default}"
 		echo -e "${blue}Swap:\t${default}${swaptotal}\t${swapused}\t${swapfree}${default}"
 	} | column -s $'\t' -t
 	} | column -s $'\t' -t
 }
 }

+ 5 - 0
lgsm/functions/core_functions.sh

@@ -222,6 +222,11 @@ functionfile="${FUNCNAME}"
 fn_fetch_function
 fn_fetch_function
 }
 }
 
 
+check_system_requirements.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
 check_tmux.sh(){
 check_tmux.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
 fn_fetch_function
 fn_fetch_function

+ 51 - 0
lgsm/functions/info_config.sh

@@ -314,6 +314,54 @@ fn_info_config_unreal(){
 	fi
 	fi
 }
 }
 
 
+fn_info_config_sdtd(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		servername="${unavailable}"
+		serverpassword="${unavailable}"
+		port="${zero}"
+		queryport="${zero}"
+		webadminenabled="${unavailable}"
+		webadminport="${zero}"
+		webadminpass="${unavailable}"
+		telnetenabled="${unavailable}"
+		telnetport="${zero}"
+		telnetpass="${unavailable}"
+		slots="${unavailable}"
+		gamemode="${unavailable}"
+		gameworld="${unavailable}"
+	else
+		servername=$(grep "ServerName" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
+		serverpassword=$(grep "ServerPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
+		port=$(grep "ServerPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
+		queryport=$((port + 1))
+
+		webadminenabled=$(grep "ControlPanelEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
+		webadminport=$(grep "ControlPanelPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
+		webadminpass=$(grep "ControlPanelPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
+		telnetenabled=$(grep "TelnetEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
+		telnetport=$(grep "TelnetPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
+		telnetpass=$(grep "TelnetPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
+
+		slots=$(grep "ServerMaxPlayerCount" "${servercfgfullpath}" | tr -cd '[:digit:]')
+		gamemode=$(grep "GameMode" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
+		gameworld=$(grep "GameWorld" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
+
+		# Not Set
+		servername=${servername:-"NOT SET"}
+		serverpassword=${serverpassword:-"NOT SET"}
+		port=${port:-"0"}
+		queryport=${queryport:-"0"}
+		webadminenabled=${webadminenabled:-"NOT SET"}
+		webadminport=${webadminport:-"0"}
+		webadminpass=${webadminpass:-"NOT SET"}
+		telnetenabled=${telnetenabled:-"NOT SET"}
+		telnetport=${telnetport:-"0"}
+		telnetpass=${telnetpass:-"NOT SET"}
+		slots=${slots:-"NOT SET"}
+		gamemode=${gamemode:-"NOT SET"}
+		gameworld=${gameworld:-"NOT SET"}
+	fi
+}
 ## Just Cause 2
 ## Just Cause 2
 if [ "${engine}" == "avalanche" ]; then
 if [ "${engine}" == "avalanche" ]; then
 	fn_info_config_avalanche
 	fn_info_config_avalanche
@@ -352,4 +400,7 @@ elif [ "${engine}" == "terraria" ]; then
 # Unreal/Unreal 2 engine
 # Unreal/Unreal 2 engine
 elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
 elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
 	fn_info_config_unreal
 	fn_info_config_unreal
+# 7 Day To Die (unity3d)
+elif [ "${gamename}" == "7 Days To Die" ]; then
+	fn_info_config_sdtd
 fi
 fi

+ 3 - 2
lgsm/functions/info_distro.sh

@@ -61,13 +61,14 @@ else
 fi
 fi
 
 
 physmemtotal=$(free ${humanreadable} | awk '/Mem:/ {print $2}')
 physmemtotal=$(free ${humanreadable} | awk '/Mem:/ {print $2}')
+physmemtotalmb=$(free -m | awk '/Mem:/ {print $2}')
 physmemused=$(free ${humanreadable} | awk '/Mem:/ {print $3}')
 physmemused=$(free ${humanreadable} | awk '/Mem:/ {print $3}')
 physmemfree=$(free ${humanreadable} | awk '/Mem:/ {print $4}')
 physmemfree=$(free ${humanreadable} | awk '/Mem:/ {print $4}')
+physmemcached=$(free ${humanreadable} | awk '/cache:/ {print $4}')
 swaptotal=$(free ${humanreadable} | awk '/Swap:/ {print $2}')
 swaptotal=$(free ${humanreadable} | awk '/Swap:/ {print $2}')
 swapused=$(free ${humanreadable} | awk '/Swap:/ {print $3}')
 swapused=$(free ${humanreadable} | awk '/Swap:/ {print $3}')
 swapfree=$(free ${humanreadable} | awk '/Swap:/ {print $4}')
 swapfree=$(free ${humanreadable} | awk '/Swap:/ {print $4}')
 
 
-
 ### Disk Infomation
 ### Disk Infomation
 
 
 ## Available disk space on the partition.
 ## Available disk space on the partition.
@@ -111,4 +112,4 @@ if [ -d "${backupdir}" ]; then
 	# size of most recent backup.
 	# size of most recent backup.
 	lastbackupsize=$(du -h "${lastbackup}" | awk '{print $1}')
 	lastbackupsize=$(du -h "${lastbackup}" | awk '{print $1}')
 
 
-fi
+fi