瀏覽代碼

Merge branch 'release/171014'

Daniel Gibbs 8 年之前
父節點
當前提交
d41727fbe3
共有 93 個文件被更改,包括 523 次插入316 次删除
  1. 19 7
      .travis.yml
  2. 0 19
      lgsm/config-default/config-lgsm/ricochetserver/_default.cfg
  3. 107 0
      lgsm/config-default/config-lgsm/sampserver/_default.cfg
  4. 1 0
      lgsm/data/serverlist.csv
  5. 1 1
      lgsm/functions/alert_email.sh
  6. 1 1
      lgsm/functions/alert_ifttt.sh
  7. 1 1
      lgsm/functions/alert_mailgun.sh
  8. 1 1
      lgsm/functions/alert_pushbullet.sh
  9. 1 1
      lgsm/functions/alert_pushover.sh
  10. 1 1
      lgsm/functions/alert_telegram.sh
  11. 2 2
      lgsm/functions/check_config.sh
  12. 9 4
      lgsm/functions/check_deps.sh
  13. 1 1
      lgsm/functions/check_executable.sh
  14. 1 1
      lgsm/functions/check_ip.sh
  15. 1 1
      lgsm/functions/check_logs.sh
  16. 1 1
      lgsm/functions/check_root.sh
  17. 1 1
      lgsm/functions/check_status.sh
  18. 1 1
      lgsm/functions/check_system_dir.sh
  19. 1 1
      lgsm/functions/check_system_requirements.sh
  20. 1 1
      lgsm/functions/command_backup.sh
  21. 1 1
      lgsm/functions/command_console.sh
  22. 1 1
      lgsm/functions/command_debug.sh
  23. 1 1
      lgsm/functions/command_details.sh
  24. 1 1
      lgsm/functions/command_dev_debug.sh
  25. 1 1
      lgsm/functions/command_dev_detect_deps.sh
  26. 1 1
      lgsm/functions/command_dev_detect_glibc.sh
  27. 6 6
      lgsm/functions/command_dev_detect_ldd.sh
  28. 1 1
      lgsm/functions/command_fastdl.sh
  29. 2 2
      lgsm/functions/command_install.sh
  30. 1 1
      lgsm/functions/command_install_resources_mta.sh
  31. 1 1
      lgsm/functions/command_mods_install.sh
  32. 1 1
      lgsm/functions/command_mods_remove.sh
  33. 1 1
      lgsm/functions/command_mods_update.sh
  34. 8 3
      lgsm/functions/command_monitor.sh
  35. 1 1
      lgsm/functions/command_postdetails.sh
  36. 1 1
      lgsm/functions/command_restart.sh
  37. 41 24
      lgsm/functions/command_start.sh
  38. 22 103
      lgsm/functions/command_stop.sh
  39. 1 1
      lgsm/functions/command_test_alert.sh
  40. 1 1
      lgsm/functions/command_ts3_server_pass.sh
  41. 1 1
      lgsm/functions/command_update.sh
  42. 1 1
      lgsm/functions/command_update_linuxgsm.sh
  43. 1 1
      lgsm/functions/command_validate.sh
  44. 1 1
      lgsm/functions/command_wipe.sh
  45. 1 1
      lgsm/functions/compress_unreal2_maps.sh
  46. 1 1
      lgsm/functions/compress_ut99_maps.sh
  47. 1 1
      lgsm/functions/core_dl.sh
  48. 5 0
      lgsm/functions/core_functions.sh
  49. 2 2
      lgsm/functions/core_getopt.sh
  50. 3 13
      lgsm/functions/fix.sh
  51. 1 1
      lgsm/functions/fix_arma3.sh
  52. 1 1
      lgsm/functions/fix_csgo.sh
  53. 1 1
      lgsm/functions/fix_dst.sh
  54. 1 1
      lgsm/functions/fix_glibc.sh
  55. 1 1
      lgsm/functions/fix_kf.sh
  56. 20 0
      lgsm/functions/fix_kf2.sh
  57. 1 1
      lgsm/functions/fix_mta.sh
  58. 1 1
      lgsm/functions/fix_ro.sh
  59. 1 1
      lgsm/functions/fix_steamcmd.sh
  60. 1 1
      lgsm/functions/fix_ut.sh
  61. 1 1
      lgsm/functions/fix_ut2k4.sh
  62. 1 1
      lgsm/functions/gsquery.py
  63. 32 1
      lgsm/functions/info_config.sh
  64. 4 2
      lgsm/functions/info_distro.sh
  65. 4 1
      lgsm/functions/info_glibc.sh
  66. 22 0
      lgsm/functions/info_messages.sh
  67. 1 1
      lgsm/functions/info_parms.sh
  68. 1 1
      lgsm/functions/install_complete.sh
  69. 12 12
      lgsm/functions/install_config.sh
  70. 1 1
      lgsm/functions/install_dst_token.sh
  71. 1 1
      lgsm/functions/install_gslt.sh
  72. 1 1
      lgsm/functions/install_header.sh
  73. 1 1
      lgsm/functions/install_logs.sh
  74. 1 1
      lgsm/functions/install_mta_resources.sh
  75. 1 1
      lgsm/functions/install_retry.sh
  76. 1 1
      lgsm/functions/install_server_dir.sh
  77. 3 1
      lgsm/functions/install_server_files.sh
  78. 1 1
      lgsm/functions/install_squad_license.sh
  79. 1 1
      lgsm/functions/install_ts3db.sh
  80. 1 1
      lgsm/functions/install_ut2k4_key.sh
  81. 1 1
      lgsm/functions/logs.sh
  82. 1 1
      lgsm/functions/mods_core.sh
  83. 1 1
      lgsm/functions/mods_list.sh
  84. 1 1
      lgsm/functions/monitor_gsquery.sh
  85. 1 1
      lgsm/functions/update_factorio.sh
  86. 1 1
      lgsm/functions/update_minecraft.sh
  87. 1 1
      lgsm/functions/update_mta.sh
  88. 1 1
      lgsm/functions/update_mumble.sh
  89. 2 2
      lgsm/functions/update_steamcmd.sh
  90. 1 1
      lgsm/functions/update_ts3.sh
  91. 4 4
      linuxgsm.sh
  92. 65 17
      tests/tests_jc2server.sh
  93. 60 23
      tests/tests_ts3server.sh

+ 19 - 7
.travis.yml

@@ -11,14 +11,26 @@ addons:
     sources:
     sources:
     - ubuntu-toolchain-r-test
     - ubuntu-toolchain-r-test
     packages:
     packages:
-    - tmux
     - mailutils
     - mailutils
-    - postfix 
-    - lib32gcc1 
-    - libstdc++6 
-    - libstdc++6:i386 
-    - telnet 
-    - expect
+    - postfix
+    - curl
+    - wget
+    - file
+    - bzip2
+    - gzip
+    - unzip
+    - bsdmainutils
+    - python
+    - util-linux
+    - ca-certificates
+    - binutils
+    - bc
+    - tmux
+    - lib32gcc1
+    - libstdc++6
+    - libstdc++6:i386
+    - net-tools
+    - iproute2
 
 
 script:
 script:
 
 

+ 0 - 19
lgsm/config-default/config-lgsm/ricochetserver/_default.cfg

@@ -20,25 +20,6 @@ fn_parms(){
 parms="-game ricochet -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}"
 parms="-game ricochet -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}"
 }
 }
 
 
-##########################
-######## Settings ########
-##########################
-
-#### Server Settings ####
-
-## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
-ip="0.0.0.0"
-
-## Optional: Game Server Login Token
-# GSLT can be used for running a public server.
-# More info: https://gameservermanagers.com/gslt
-gslt=""
-
-## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
-fn_parms(){
-parms=""
-}
-
 #### LinuxGSM Settings ####
 #### LinuxGSM Settings ####
 
 
 ## Notification Alerts
 ## Notification Alerts

+ 107 - 0
lgsm/config-default/config-lgsm/sampserver/_default.cfg

@@ -0,0 +1,107 @@
+##################################
+######## Default Settings ########
+##################################
+# DO NOT EDIT WILL BE OVERWRITTEN!
+# Copy settings from here and use them in either
+# common.cfg - applies settings to every instance
+# [instance].cfg - applies settings to a specific instance
+
+#### Server Settings ####
+
+## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
+ip="0.0.0.0"
+port="7777"
+
+## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
+fn_parms(){
+parms=""
+}
+
+#### LinuxGSM Settings ####
+
+## Notification Alerts
+# (on|off)
+
+# More info | https://github.com/GameServerManagers/LinuxGSM/wiki/Alerts#more-info
+postalert="off"
+postdays="7"
+posttarget="https://hastebin.com"
+
+# Discord Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Discord
+discordalert="off"
+discordwebhook="webhook"
+
+# Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email
+emailalert="off"
+email="email@example.com"
+emailfrom=""
+
+# IFTTT Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/IFTTT
+iftttalert="off"
+ifttttoken="accesstoken"
+iftttevent="linuxgsm_alert"
+
+# Mailgun Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/mailgun
+mailgunalert="off"
+mailguntoken="accesstoken"
+mailgundomain="example.com"
+mailgunemailfrom="alert@example.com"
+mailgunemail="email@myemail.com"
+
+# Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet
+pushbulletalert="off"
+pushbullettoken="accesstoken"
+channeltag=""
+
+# Pushover Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushover
+pushoveralert="off"
+pushovertoken="accesstoken"
+
+# Telegram Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Telegram
+telegramalert="off"
+telegramtoken="accesstoken"
+telegramchatid=""
+
+## Backup | https://github.com/GameServerManagers/LinuxGSM/wiki/Backup
+maxbackups="4"
+maxbackupdays="30"
+stoponbackup="on"
+
+## Logging | https://github.com/GameServerManagers/LinuxGSM/wiki/Logging
+consolelogging="on"
+logdays="7"
+
+#### LinuxGSM Advanced Settings ####
+
+## LinuxGSM Server Details
+# Do not edit
+gamename="San Andreas Multiplayer"
+engine="renderware"
+
+#### Directories ####
+# Edit with care
+
+## Server Specific Directories
+systemdir="${serverfiles}"
+executabledir="${systemdir}/samp03"
+executable="./samp03svr"
+servercfg="server.cfg"
+servercfgdir="${systemdir}/samp03"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+
+## Backup Directory
+backupdir="${rootdir}/backups"
+
+## Logging Directories
+logdir="${rootdir}/log"
+gamelogdir="${serverfiles}/samp03"
+lgsmlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
+lgsmlog="${lgsmlogdir}/${servicename}-script.log"
+consolelog="${consolelogdir}/${servicename}-console.log"
+alertlog="${lgsmlogdir}/${servicename}-alert.log"
+postdetailslog="${lgsmlogdir}/${servicename}-postdetails.log"
+
+## Logs Naming
+lgsmlogdate="${lgsmlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
+consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"

+ 1 - 0
lgsm/data/serverlist.csv

@@ -54,6 +54,7 @@ qw,qwserver,Quake World
 ro,roserver,Red Orchestra: Ostfront 41-45
 ro,roserver,Red Orchestra: Ostfront 41-45
 ricochet,ricochetserver,Ricochet
 ricochet,ricochetserver,Ricochet
 rust,rustserver,Rust
 rust,rustserver,Rust
+samp,sampserver,San Andreas Multiplayer
 ss3,ss3server,Serious Sam 3: BFE
 ss3,ss3server,Serious Sam 3: BFE
 sb,sbserver,Starbound
 sb,sbserver,Starbound
 squad,squadserver,Squad
 squad,squadserver,Squad

+ 1 - 1
lgsm/functions/alert_email.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="ALERT"
 local commandname="ALERT"
 local commandaction="Alert"
 local commandaction="Alert"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_print_dots "Sending Email alert: ${email}"
 fn_print_dots "Sending Email alert: ${email}"
 sleep 0.5
 sleep 0.5

+ 1 - 1
lgsm/functions/alert_ifttt.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="ALERT"
 local commandname="ALERT"
 local commandaction="Alert"
 local commandaction="Alert"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 json=$(cat <<EOF
 json=$(cat <<EOF
 {
 {

+ 1 - 1
lgsm/functions/alert_mailgun.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="ALERT"
 local commandname="ALERT"
 local commandaction="Alert"
 local commandaction="Alert"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_print_dots "Sending Email alert: Mailgun: ${email}"
 fn_print_dots "Sending Email alert: Mailgun: ${email}"
 sleep 0.5
 sleep 0.5

+ 1 - 1
lgsm/functions/alert_pushbullet.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="ALERT"
 local commandname="ALERT"
 local commandaction="Alert"
 local commandaction="Alert"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 json=$(cat <<EOF
 json=$(cat <<EOF
 {
 {

+ 1 - 1
lgsm/functions/alert_pushover.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="ALERT"
 local commandname="ALERT"
 local commandaction="Alert"
 local commandaction="Alert"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_print_dots "Sending Pushover alert"
 fn_print_dots "Sending Pushover alert"
 sleep 0.5
 sleep 0.5

+ 1 - 1
lgsm/functions/alert_telegram.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="ALERT"
 local commandname="ALERT"
 local commandaction="Alert"
 local commandaction="Alert"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 json=$(cat <<EOF
 json=$(cat <<EOF
 {
 {

+ 2 - 2
lgsm/functions/check_config.sh

@@ -5,10 +5,10 @@
 # Description: Checks if the server config is missing and warns the user if needed.
 # Description: Checks if the server config is missing and warns the user if needed.
 
 
 local commandname="CHECK"
 local commandname="CHECK"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 if [ ! -e "${servercfgfullpath}" ]; then
 if [ ! -e "${servercfgfullpath}" ]; then
-	if [ "${gamename}" != "Hurtworld" ]||[ "${shortname}" != "ut3" ]||[ "${shortname}" != "kf2" ]; then
+	if [ "${gamename}" != "Hurtworld" ]&&[ "${shortname}" != "ut3" ]&&[ "${shortname}" != "kf2" ]; then
 		fn_print_dots ""
 		fn_print_dots ""
 		sleep 0.5
 		sleep 0.5
 		fn_print_warn_nl "Configuration file missing!"
 		fn_print_warn_nl "Configuration file missing!"

+ 9 - 4
lgsm/functions/check_deps.sh

@@ -19,7 +19,7 @@ fn_deps_detector(){
 		deptocheck="${javaversion}"
 		deptocheck="${javaversion}"
 		unset javacheck
 		unset javacheck
 	elif [ -n "$(command -v apt-get 2>/dev/null)" ]; then
 	elif [ -n "$(command -v apt-get 2>/dev/null)" ]; then
-		dpkg-query -W -f='${Status}' ${deptocheck} 2>/dev/null | grep -q -P '^install ok installed$'
+		dpkg-query -W -f='${Status}' ${deptocheck} 2>/dev/null | grep -q -P '^install ok installed'
 		depstatus=$?
 		depstatus=$?
 	elif [ -n "$(command -v yum 2>/dev/null)" ]; then
 	elif [ -n "$(command -v yum 2>/dev/null)" ]; then
 		yum -q list installed ${deptocheck} > /dev/null 2>&1
 		yum -q list installed ${deptocheck} > /dev/null 2>&1
@@ -145,7 +145,7 @@ if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
 	array_deps_missing=()
 	array_deps_missing=()
 
 
 	# LinuxGSM requirements
 	# LinuxGSM requirements
-	array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python bzip2 gzip unzip binutils )
+	array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python bzip2 gzip unzip binutils bc )
 
 
 	# All servers except ts3 require tmux
 	# All servers except ts3 require tmux
 	if [ "${gamename}" != "TeamSpeak 3" ]; then
 	if [ "${gamename}" != "TeamSpeak 3" ]; then
@@ -195,6 +195,9 @@ if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
 	# Factorio
 	# Factorio
 	elif [ "${gamename}" == "Factorio" ]; then
 	elif [ "${gamename}" == "Factorio" ]; then
 		array_deps_required+=( xz-utils )
 		array_deps_required+=( xz-utils )
+	# Hurtword/Rust
+	elif [ "${gamename}" == "Hurtword" ]||[ "${gamename}" == "Rust" ]; then
+		array_deps_required+=( lib32z1 )
 	# Project Zomboid and Minecraft
 	# Project Zomboid and Minecraft
 	elif [ "${engine}" ==  "projectzomboid" ]||[ "${engine}" == "lwjgl2" ]; then
 	elif [ "${engine}" ==  "projectzomboid" ]||[ "${engine}" == "lwjgl2" ]; then
 		javaversion=$(java -version 2>&1 | grep "version")
 		javaversion=$(java -version 2>&1 | grep "version")
@@ -231,9 +234,9 @@ elif [ -n "$(command -v yum 2>/dev/null)" ]; then
 
 
 	# LinuxGSM requirements
 	# LinuxGSM requirements
 	if [ "${distroversion}" == "6" ]; then
 	if [ "${distroversion}" == "6" ]; then
-		array_deps_required=( curl wget util-linux-ng python file gzip bzip2 unzip )
+		array_deps_required=( curl wget util-linux-ng python file gzip bzip2 unzip binutils bc )
 	else
 	else
-		array_deps_required=( curl wget util-linux python file gzip bzip2 unzip )
+		array_deps_required=( curl wget util-linux python file gzip bzip2 unzip binutils bc )
 	fi
 	fi
 
 
 	# All servers except ts3 require tmux
 	# All servers except ts3 require tmux
@@ -276,6 +279,8 @@ elif [ -n "$(command -v yum 2>/dev/null)" ]; then
 	# Factorio
 	# Factorio
 	elif [ "${gamename}" == "Factorio" ]; then
 	elif [ "${gamename}" == "Factorio" ]; then
 		array_deps_required+=( xz )
 		array_deps_required+=( xz )
+	elif [ "${gamename}" == "Hurtword" ]||[ "${gamename}" == "Rust" ]; then
+		array_deps_required+=( zlib-devel )
 	# Project Zomboid and Minecraft
 	# Project Zomboid and Minecraft
 	elif [ "${engine}" ==  "projectzomboid" ]||[ "${engine}" == "lwjgl2" ]; then
 	elif [ "${engine}" ==  "projectzomboid" ]||[ "${engine}" == "lwjgl2" ]; then
 		javaversion=$(java -version 2>&1 | grep "version")
 		javaversion=$(java -version 2>&1 | grep "version")

+ 1 - 1
lgsm/functions/check_executable.sh

@@ -5,7 +5,7 @@
 # Description: Checks if executable exists.
 # Description: Checks if executable exists.
 
 
 local commandname="CHECK"
 local commandname="CHECK"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 # Check if executable exists
 # Check if executable exists
 if [ ! -f "${executabledir}/${execname}" ]; then
 if [ ! -f "${executabledir}/${execname}" ]; then

+ 1 - 1
lgsm/functions/check_ip.sh

@@ -6,7 +6,7 @@
 # If multiple interfaces are detected the user will need to manually set using ip="0.0.0.0".
 # If multiple interfaces are detected the user will need to manually set using ip="0.0.0.0".
 
 
 local commandname="CHECK"
 local commandname="CHECK"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travistest}" != "1" ]; then
 if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travistest}" != "1" ]; then
 	if [ ! -f "/bin/ip" ]; then
 	if [ ! -f "/bin/ip" ]; then

+ 1 - 1
lgsm/functions/check_logs.sh

@@ -5,7 +5,7 @@
 # Description: Checks if log files exist.
 # Description: Checks if log files exist.
 
 
 local commandname="CHECK"
 local commandname="CHECK"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_check_logs(){
 fn_check_logs(){
 	fn_print_dots "Checking for log files"
 	fn_print_dots "Checking for log files"

+ 1 - 1
lgsm/functions/check_root.sh

@@ -5,7 +5,7 @@
 # Description: Checks if the user tried to run the script as root.
 # Description: Checks if the user tried to run the script as root.
 
 
 local commandname="CHECK"
 local commandname="CHECK"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 if [ $(whoami) = "root" ]; then
 if [ $(whoami) = "root" ]; then
 	fn_print_fail_nl "Do NOT run this script as root!"
 	fn_print_fail_nl "Do NOT run this script as root!"

+ 1 - 1
lgsm/functions/check_status.sh

@@ -6,7 +6,7 @@
 # Description: Checks the process status of the server. Either online or offline.
 # Description: Checks the process status of the server. Either online or offline.
 
 
 local commandname="CHECK"
 local commandname="CHECK"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 if [ "${gamename}" == "TeamSpeak 3" ]; then
 if [ "${gamename}" == "TeamSpeak 3" ]; then
 	# 1: Server is running
 	# 1: Server is running

+ 1 - 1
lgsm/functions/check_system_dir.sh

@@ -5,7 +5,7 @@
 # Description: Checks if systemdir/serverfiles is accessible.
 # Description: Checks if systemdir/serverfiles is accessible.
 
 
 local commandname="CHECK"
 local commandname="CHECK"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 if [ "${function_selfname}" != "command_validate.sh" ]; then
 if [ "${function_selfname}" != "command_validate.sh" ]; then
 	checkdir="${serverfiles}"
 	checkdir="${serverfiles}"

+ 1 - 1
lgsm/functions/check_system_requirements.sh

@@ -6,7 +6,7 @@
 # Description: Checks RAM requirements
 # Description: Checks RAM requirements
 
 
 local commandname="CHECK"
 local commandname="CHECK"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 info_distro.sh
 info_distro.sh
 
 

+ 1 - 1
lgsm/functions/command_backup.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="BACKUP"
 local commandname="BACKUP"
 local commandaction="Backup"
 local commandaction="Backup"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 check.sh
 check.sh
 
 

+ 1 - 1
lgsm/functions/command_console.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="CONSOLE"
 local commandname="CONSOLE"
 local commandaction="Console"
 local commandaction="Console"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 check.sh
 check.sh
 fn_print_header
 fn_print_header

+ 1 - 1
lgsm/functions/command_debug.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="DEBUG"
 local commandname="DEBUG"
 local commandaction="Debug"
 local commandaction="Debug"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 # Trap to remove lockfile on quit.
 # Trap to remove lockfile on quit.
 fn_lockfile_trap(){
 fn_lockfile_trap(){

+ 1 - 1
lgsm/functions/command_details.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="DETAILS"
 local commandname="DETAILS"
 local commandaction="Details"
 local commandaction="Details"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 # Run checks and gathers details to display.
 # Run checks and gathers details to display.
 check.sh
 check.sh

+ 1 - 1
lgsm/functions/command_dev_debug.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="DEV-DEBUG"
 local commandname="DEV-DEBUG"
 local commandaction="Dev-Debug"
 local commandaction="Dev-Debug"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 if [ -f "${rootdir}/.dev-debug" ]; then
 if [ -f "${rootdir}/.dev-debug" ]; then
 	rm "${rootdir}/.dev-debug"
 	rm "${rootdir}/.dev-debug"

+ 1 - 1
lgsm/functions/command_dev_detect_deps.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="DEPS-DETECT"
 local commandname="DEPS-DETECT"
 local commandaction="Deps-Detect"
 local commandaction="Deps-Detect"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 echo "================================="
 echo "================================="
 echo "Dependencies Checker"
 echo "Dependencies Checker"

+ 1 - 1
lgsm/functions/command_dev_detect_glibc.sh

@@ -16,7 +16,7 @@ if [ -z "$(command -v objdump)" ]; then
 fi
 fi
 
 
 if [ -z "${serverfiles}" ]; then
 if [ -z "${serverfiles}" ]; then
-	dir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
+	dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
 fi
 fi
 
 
 if [ -d "${serverfiles}" ]; then
 if [ -d "${serverfiles}" ]; then

+ 6 - 6
lgsm/functions/command_dev_detect_ldd.sh

@@ -10,7 +10,7 @@ echo "Shared Object dependencies Checker"
 echo "================================="
 echo "================================="
 
 
 if [ -z "${serverfiles}" ]; then
 if [ -z "${serverfiles}" ]; then
-	dir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
+	dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
 fi
 fi
 
 
 if [ -d "${serverfiles}" ]; then
 if [ -d "${serverfiles}" ]; then
@@ -26,13 +26,13 @@ files=$(find "${serverfiles}" | wc -l)
 find "${serverfiles}" -type f -print0 |
 find "${serverfiles}" -type f -print0 |
 while IFS= read -r -d $'\0' line; do
 while IFS= read -r -d $'\0' line; do
 	#ldd -v $line 2>/dev/null|grep "=>" >>"${tmpdir}/detect_ldd.tmp"
 	#ldd -v $line 2>/dev/null|grep "=>" >>"${tmpdir}/detect_ldd.tmp"
-	if [ -n "$(ldd $line 2>/dev/null |grep -v "not a dynamic executable")" ]; then
-		echo "$line" >> "${tmpdir}/detect_ldd.tmp"
-		ldd $line 2>/dev/null |grep -v "not a dynamic executable" >> "${tmpdir}/detect_ldd.tmp"
+	if [ -n "$(ldd ${line} 2>/dev/null |grep -v "not a dynamic executable")" ]; then
+		echo "${line}" >> "${tmpdir}/detect_ldd.tmp"
+		ldd "${line}" 2>/dev/null |grep -v "not a dynamic executable" >> "${tmpdir}/detect_ldd.tmp"
 
 
 		if [ -n "$(ldd $line 2>/dev/null |grep -v "not a dynamic executable"|grep "not found")" ]; then
 		if [ -n "$(ldd $line 2>/dev/null |grep -v "not a dynamic executable"|grep "not found")" ]; then
-			echo "$line" >> "${tmpdir}/detect_ldd_not_found.tmp"
-			ldd $line 2>/dev/null |grep -v "not a dynamic executable"|grep "not found" >> "${tmpdir}/detect_ldd_not_found.tmp"
+			echo "${line}" >> "${tmpdir}/detect_ldd_not_found.tmp"
+			ldd "${line}" 2>/dev/null |grep -v "not a dynamic executable"|grep "not found" >> "${tmpdir}/detect_ldd_not_found.tmp"
 		fi
 		fi
 	fi
 	fi
 	echo -n "$i / $files" $'\r'
 	echo -n "$i / $files" $'\r'

+ 1 - 1
lgsm/functions/command_fastdl.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="FASTDL"
 local commandname="FASTDL"
 local commandaction="FastDL"
 local commandaction="FastDL"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 check.sh
 check.sh
 
 

+ 2 - 2
lgsm/functions/command_install.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="INSTALL"
 local commandname="INSTALL"
 local commandaction="Install"
 local commandaction="Install"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 check.sh
 check.sh
 install_header.sh
 install_header.sh
@@ -19,7 +19,7 @@ installflag=1
 if [ "${gamename}" == "Unreal Tournament 2004" ]; then
 if [ "${gamename}" == "Unreal Tournament 2004" ]; then
 	install_server_files.sh
 	install_server_files.sh
 	install_ut2k4_key.sh
 	install_ut2k4_key.sh
-elif [ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty: United Offensive" ]||[ "${gamename}" == "Call of Duty 2" ]||[ "${gamename}" == "Call of Duty 4" ]||[ "${gamename}" == "Call of Duty: World at War" ]||[ "${gamename}" == "Factorio" ]||[ "${gamename}" == "Minecraft" ]||[ "${gamename}" == "Multi Theft Auto" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament" ]||[ "${gamename}" == "Unreal Tournament 3" ]||[ "${gamename}" == "TeamSpeak 3" ]||[ "${gamename}" == "Mumble" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
+elif [ -z "${appid}" ]; then
 	installer=1
 	installer=1
 	install_server_files.sh
 	install_server_files.sh
 elif [ -n "${appid}" ]; then
 elif [ -n "${appid}" ]; then

+ 1 - 1
lgsm/functions/command_install_resources_mta.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="DEFAULT_RESOURCES"
 local commandname="DEFAULT_RESOURCES"
 local commandaction="Default Resources"
 local commandaction="Default Resources"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_install_resources(){
 fn_install_resources(){
 	echo ""
 	echo ""

+ 1 - 1
lgsm/functions/command_mods_install.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="MODS"
 local commandname="MODS"
 local commandaction="addons/mods"
 local commandaction="addons/mods"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 check.sh
 check.sh
 mods_core.sh
 mods_core.sh

+ 1 - 1
lgsm/functions/command_mods_remove.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="MODS"
 local commandname="MODS"
 local commandaction="addons/mods"
 local commandaction="addons/mods"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 check.sh
 check.sh
 mods_core.sh
 mods_core.sh

+ 1 - 1
lgsm/functions/command_mods_update.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="MODS"
 local commandname="MODS"
 local commandaction="Mods Update"
 local commandaction="Mods Update"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 check.sh
 check.sh
 mods_core.sh
 mods_core.sh

+ 8 - 3
lgsm/functions/command_monitor.sh

@@ -8,7 +8,7 @@
 
 
 local commandname="MONITOR"
 local commandname="MONITOR"
 local commandaction="Monitor"
 local commandaction="Monitor"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_monitor_check_lockfile(){
 fn_monitor_check_lockfile(){
 	# Monitor does not run it lockfile is not found
 	# Monitor does not run it lockfile is not found
@@ -79,10 +79,15 @@ fn_monitor_tmux(){
 		fn_print_ok_eol_nl
 		fn_print_ok_eol_nl
 		fn_script_log_pass "Checking session: OK"
 		fn_script_log_pass "Checking session: OK"
 		# runs gsquery check on game with specific engines.
 		# runs gsquery check on game with specific engines.
-		local allowed_engines_array=( avalanche goldsource idtech3 idtech3_ql iw2.0 iw3.0 madness quake refractor realvirtuality source spark unity3d unreal unreal2 )
+		local allowed_engines_array=( avalanche goldsource idtech3 idtech3_ql iw2.0 iw3.0 madness quake refractor realvirtuality source spark starbound unity3d unreal unreal2 )
 		for allowed_engine in "${allowed_engines_array[@]}"
 		for allowed_engine in "${allowed_engines_array[@]}"
 		do
 		do
-			if [ "${allowed_engine}" == "${engine}" ]; then
+			if [ "${allowed_engine}" == "starbound" ]; then
+				info_config.sh
+				if [ "${queryenabled}" == "true" ]; then
+					monitor_gsquery.sh
+				fi
+			elif [ "${allowed_engine}" == "${engine}" ]; then
 				monitor_gsquery.sh
 				monitor_gsquery.sh
 			fi
 			fi
 		done
 		done

+ 1 - 1
lgsm/functions/command_postdetails.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="postdetails"
 local commandname="postdetails"
 local commandaction="Postdetails"
 local commandaction="Postdetails"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 # Set posttarget to the appropriately-defined post destination.
 # Set posttarget to the appropriately-defined post destination.
 
 

+ 1 - 1
lgsm/functions/command_restart.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="RESTART"
 local commandname="RESTART"
 local commandaction="Restarting"
 local commandaction="Restarting"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 info_config.sh
 info_config.sh
 exitbypass=1
 exitbypass=1

+ 41 - 24
lgsm/functions/command_start.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="START"
 local commandname="START"
 local commandaction="Starting"
 local commandaction="Starting"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_start_teamspeak3(){
 fn_start_teamspeak3(){
 	if [ ! -e "${servercfgfullpath}" ]; then
 	if [ ! -e "${servercfgfullpath}" ]; then
@@ -100,30 +100,47 @@ fn_start_tmux(){
 	cd "${executabledir}"
 	cd "${executabledir}"
 	tmux new-session -d -x "${sessionheight}" -y "${sessionwidth}" -s "${servicename}" "${executable} ${parms}" 2> "${lgsmlogdir}/.${servicename}-tmux-error.tmp"
 	tmux new-session -d -x "${sessionheight}" -y "${sessionwidth}" -s "${servicename}" "${executable} ${parms}" 2> "${lgsmlogdir}/.${servicename}-tmux-error.tmp"
 
 
-	# tmux pipe-pane not supported in tmux versions < 1.6
-	if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -lt "16" ] 2>/dev/null; then # Tmux compiled from source will not return a number, therefore bypass this check and trash the error
-		echo "Console logging disabled: Tmux => 1.6 required
-		https://gameservermanagers.com/tmux-upgrade
-		Currently installed: $(tmux -V)" > "${consolelog}"
-
-	# Console logging disabled: Bug in tmux 1.8 breaks logging
-	elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -eq "18" ] 2>/dev/null; then
-		echo "Console logging disabled: Bug in tmux 1.8 breaks logging
-		https://gameservermanagers.com/tmux-upgrade
-		Currently installed: $(tmux -V)" > "${consolelog}"
-
-	# Console logging enable or not set
-	elif [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
-		touch "${consolelog}"
-		tmux pipe-pane -o -t "${servicename}" "exec cat >> '${consolelog}'"
-
-	# Console logging disabled
-	elif [ "${consolelogging}" == "off" ]; then
-		touch "${consolelog}"
-		cat "Console logging disabled by user" >> "{consolelog}"
-		fn_script_log_info "Console logging disabled by user"
+	# Create logfile
+	touch "${consolelog}"
+
+	# Get tmux version
+	tmuxversion="$(tmux -V|sed "s/tmux //"|sed -n '1 p')"
+	# Tmux compiled from source will return "master", therefore ignore it
+	if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p')" == "master" ]; then
+		fn_script_log "Tmux version: master (user compiled)"
+		echo "Tmux version: master (user compiled)" >> "${consolelog}"
+		if [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
+			tmux pipe-pane -o -t "${servicename}" "exec cat >> '${consolelog}'"
+		fi
+	elif [ -n "${tmuxversion}" ]; then
+		# Get the digit version of tmux
+		tmuxversion="$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')"
+		# tmux pipe-pane not supported in tmux versions < 1.6
+		if [ "${tmuxversion}" -lt "16" ]; then
+			echo "Console logging disabled: Tmux => 1.6 required
+			https://gameservermanagers.com/tmux-upgrade
+			Currently installed: $(tmux -V)" > "${consolelog}"
+
+		# Console logging disabled: Bug in tmux 1.8 breaks logging
+		elif [ "${tmuxversion}" -eq "18" ]; then
+			echo "Console logging disabled: Bug in tmux 1.8 breaks logging
+			https://gameservermanagers.com/tmux-upgrade
+			Currently installed: $(tmux -V)" > "${consolelog}"
+		# Console logging enable or not set
+		elif [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
+			tmux pipe-pane -o -t "${servicename}" "exec cat >> '${consolelog}'"
+		fi
+	else
+		echo "Unable to detect tmux version" >> "${consolelog}"
+		fn_script_log_warn "Unable to detect tmux version"
 	fi
 	fi
-	sleep 1
+
+# Console logging disabled
+if [ "${consolelogging}" == "off" ]; then
+	echo "Console logging disabled by user" >> "${consolelog}"
+	fn_script_log_info "Console logging disabled by user"
+fi
+sleep 1
 
 
 	# If the server fails to start
 	# If the server fails to start
 	check_status.sh
 	check_status.sh

+ 22 - 103
lgsm/functions/command_stop.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="STOP"
 local commandname="STOP"
 local commandaction="Stopping"
 local commandaction="Stopping"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 # Attempts graceful shutdown by sending the 'CTRL+c'.
 # Attempts graceful shutdown by sending the 'CTRL+c'.
 fn_stop_graceful_ctrlc(){
 fn_stop_graceful_ctrlc(){
@@ -37,29 +37,31 @@ fn_stop_graceful_ctrlc(){
 	fn_stop_tmux
 	fn_stop_tmux
 }
 }
 
 
-# Attempts graceful shutdown by sending the 'quit' command.
-fn_stop_graceful_quit(){
-	fn_print_dots "Graceful: sending \"quit\""
-	fn_script_log_info "Graceful: sending \"quit\""
-	# sends quit
-	tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1
-	# waits up to 30 seconds giving the server time to shutdown gracefuly
-	for seconds in {1..30}; do
+# Attempts graceful shutdown by sending a specified command.
+# Usage: fn_stop_graceful_cmd "console_command" "timeout_in_seconds"
+#  e.g.: fn_stop_graceful_cmd "quit" "30"
+fn_stop_graceful_cmd(){
+	fn_print_dots "Graceful: sending \"${1}\""
+	fn_script_log_info "Graceful: sending \"${1}\""
+	# sends specific stop command
+	tmux send -t "${servicename}" ${1} ENTER > /dev/null 2>&1
+	# waits up to given seconds giving the server time to shutdown gracefully
+	for ((seconds=1; seconds<=${2}; seconds++)); do
 		check_status.sh
 		check_status.sh
 		if [ "${status}" == "0" ]; then
 		if [ "${status}" == "0" ]; then
-			fn_print_ok "Graceful: sending \"quit\": ${seconds}: "
+			fn_print_ok "Graceful: sending \"${1}\": ${seconds}: "
 			fn_print_ok_eol_nl
 			fn_print_ok_eol_nl
-			fn_script_log_pass "Graceful: sending \"quit\": OK: ${seconds} seconds"
+			fn_script_log_pass "Graceful: sending \"${1}\": OK: ${seconds} seconds"
 			break
 			break
 		fi
 		fi
 		sleep 1
 		sleep 1
-		fn_print_dots "Graceful: sending \"quit\": ${seconds}"
+		fn_print_dots "Graceful: sending \"${1}\": ${seconds}"
 	done
 	done
 	check_status.sh
 	check_status.sh
 	if [ "${status}" != "0" ]; then
 	if [ "${status}" != "0" ]; then
-		fn_print_error "Graceful: sending \"quit\": "
+		fn_print_error "Graceful: sending \"${1}\": "
 		fn_print_fail_eol_nl
 		fn_print_fail_eol_nl
-		fn_script_log_error "Graceful: sending \"quit\": FAIL"
+		fn_script_log_error "Graceful: sending \"${1}\": FAIL"
 	fi
 	fi
 	sleep 1
 	sleep 1
 	fn_stop_tmux
 	fn_stop_tmux
@@ -175,105 +177,22 @@ fn_stop_graceful_sdtd(){
 	fn_stop_tmux
 	fn_stop_tmux
 }
 }
 
 
-# Attempts graceful of Minecraft using rcon 'stop' command.
-fn_stop_graceful_minecraft(){
-	fn_print_dots "Graceful: sending \"stop\""
-	fn_script_log_info "Graceful: sending \"stop\""
-	# sends quit
-	tmux send -t "${servicename}" stop ENTER > /dev/null 2>&1
-	# waits up to 30 seconds giving the server time to shutdown gracefuly
-	for seconds in {1..30}; do
-		check_status.sh
-		if [ "${status}" == "0" ]; then
-			fn_print_ok "Graceful: sending \"stop\": ${seconds}: "
-			fn_print_ok_eol_nl
-			fn_script_log_pass "Graceful: sending \"stop\": OK: ${seconds} seconds"
-			break
-		fi
-		sleep 1
-		fn_print_dots "Graceful: sending \"stop\": ${seconds}"
-	done
-	check_status.sh
-	if [ "${status}" != "0" ]; then
-		fn_print_error "Graceful: sending \"stop\": "
-		fn_print_fail_eol_nl
-		fn_script_log_error "Graceful: sending \"stop\": FAIL"
-	fi
-	sleep 1
-	fn_stop_tmux
-}
-
-# Attempts graceful of mta using rcon 'quit' command.
-fn_stop_graceful_mta(){
-	fn_print_dots "Graceful: sending \"quit\""
-	fn_script_log_info "Graceful: sending \"quit\""
-	# sends quit
-	tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1
-	# waits up to 120 seconds giving the server time to shutdown gracefuly, we need a long wait time here as resources are stopped individually and process their own shutdowns
-	for seconds in {1..120}; do
-		check_status.sh
-		if [ "${status}" == "0" ]; then
-			fn_print_ok "Graceful: sending \"quit\": ${seconds}: "
-			fn_print_ok_eol_nl
-			fn_script_log_pass "Graceful: sending \"quit\": OK: ${seconds} seconds"
-			break
-		fi
-		sleep 1
-		fn_print_dots "Graceful: sending \"quit\": ${seconds}"
-	done
-	check_status.sh
-	if [ "${status}" != "0" ]; then
-		fn_print_error "Graceful: sending \"quit\": "
-		fn_print_fail_eol_nl
-		fn_script_log_error "Graceful: sending \"quit\": FAIL"
-	fi
-	sleep 1
-	fn_stop_tmux
-}
-
-# Attempts graceful of Terraria using 'exit' console command.
-fn_stop_graceful_terraria(){
-	fn_print_dots "Graceful: sending \"exit\""
-	fn_script_log_info "Graceful: sending \"exit\""
-	# sends exit
-	tmux send -t "${servicename}" exit ENTER > /dev/null 2>&1
-	# waits up to 30 seconds giving the server time to shutdown gracefuly
-	for seconds in {1..30}; do
-		check_status.sh
-		if [ "${status}" == "0" ]; then
-			fn_print_ok "Graceful: sending \"exit\": ${seconds}: "
-			fn_print_ok_eol_nl
-			fn_script_log_pass "Graceful: sending \"exit\": OK: ${seconds} seconds"
-			break
-		fi
-		sleep 1
-		fn_print_dots "Graceful: sending \"exit\": ${seconds}"
-	done
-	check_status.sh
-	if [ "${status}" != "0" ]; then
-		fn_print_error "Graceful: sending \"exit\": "
-		fn_print_fail_eol_nl
-		fn_script_log_error "Graceful: sending \"exit\": FAIL"
-	fi
-	sleep 1
-	fn_stop_tmux
-}
-
 fn_stop_graceful_select(){
 fn_stop_graceful_select(){
 	if [ "${gamename}" == "7 Days To Die" ]; then
 	if [ "${gamename}" == "7 Days To Die" ]; then
 		fn_stop_graceful_sdtd
 		fn_stop_graceful_sdtd
 	elif [ "${gamename}" == "Terraria" ]; then
 	elif [ "${gamename}" == "Terraria" ]; then
-		fn_stop_graceful_terraria
+		fn_stop_graceful_cmd "exit" 30
 	elif [ "${gamename}" == "Minecraft" ]; then
 	elif [ "${gamename}" == "Minecraft" ]; then
-		fn_stop_graceful_minecraft
+		fn_stop_graceful_cmd "stop" 30
 	elif [ "${gamename}" == "Multi Theft Auto" ]; then
 	elif [ "${gamename}" == "Multi Theft Auto" ]; then
-		fn_stop_graceful_mta
+		# we need a long wait time here as resources are stopped individually and process their own shutdowns
+		fn_stop_graceful_cmd "quit" 120
 	elif [ "${engine}" == "goldsource" ]; then
 	elif [ "${engine}" == "goldsource" ]; then
 		fn_stop_graceful_goldsource
 		fn_stop_graceful_goldsource
 	elif [ "${gamename}" == "Factorio" ]||[ "${engine}" == "unity3d" ]||[ "${engine}" == "unreal4" ]||[ "${engine}" == "unreal3" ]||[ "${engine}" == "unreal2" ]||[ "${engine}" == "unreal" ]||[ "${gamename}" == "Mumble" ]; then
 	elif [ "${gamename}" == "Factorio" ]||[ "${engine}" == "unity3d" ]||[ "${engine}" == "unreal4" ]||[ "${engine}" == "unreal3" ]||[ "${engine}" == "unreal2" ]||[ "${engine}" == "unreal" ]||[ "${gamename}" == "Mumble" ]; then
 		fn_stop_graceful_ctrlc
 		fn_stop_graceful_ctrlc
-	elif  [ "${engine}" == "source" ]||[ "${engine}" == "quake" ]||[ "${engine}" == "idtech2" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "idtech3_ql" ]||[ "${engine}" == "Just Cause 2" ]; then
-		fn_stop_graceful_quit
+	elif  [ "${engine}" == "source" ]||[ "${engine}" == "quake" ]||[ "${engine}" == "idtech2" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "idtech3_ql" ]||[ "${engine}" == "Just Cause 2" ]||[ "${engine}" == "projectzomboid" ]; then
+		fn_stop_graceful_cmd "quit" 30
 	else
 	else
 		fn_stop_tmux
 		fn_stop_tmux
 	fi
 	fi

+ 1 - 1
lgsm/functions/command_test_alert.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="ALERT"
 local commandname="ALERT"
 local commandaction="Alert"
 local commandaction="Alert"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_print_dots "${servername}"
 fn_print_dots "${servername}"
 sleep 1
 sleep 1

+ 1 - 1
lgsm/functions/command_ts3_server_pass.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="TS3-CHANGE-PASS"
 local commandname="TS3-CHANGE-PASS"
 local commandaction="ServerAdmin Password Change"
 local commandaction="ServerAdmin Password Change"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_serveradmin_password_prompt(){
 fn_serveradmin_password_prompt(){
 	fn_print_header
 	fn_print_header

+ 1 - 1
lgsm/functions/command_update.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="UPDATE"
 local commandname="UPDATE"
 local commandaction="Update"
 local commandaction="Update"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_print_dots ""
 fn_print_dots ""
 sleep 0.5
 sleep 0.5

+ 1 - 1
lgsm/functions/command_update_linuxgsm.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="UPDATE LinuxGSM"
 local commandname="UPDATE LinuxGSM"
 local commandaction="Update LinuxGSM"
 local commandaction="Update LinuxGSM"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_print_dots "Updating LinuxGSM"
 fn_print_dots "Updating LinuxGSM"
 sleep 1
 sleep 1

+ 1 - 1
lgsm/functions/command_validate.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="VALIDATE"
 local commandname="VALIDATE"
 local commandaction="Validate"
 local commandaction="Validate"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_validation(){
 fn_validation(){
 	appid="${1}"
 	appid="${1}"

+ 1 - 1
lgsm/functions/command_wipe.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="WIPE"
 local commandname="WIPE"
 local commandaction="data wipe"
 local commandaction="data wipe"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 check.sh
 check.sh
 fn_print_header
 fn_print_header

+ 1 - 1
lgsm/functions/compress_unreal2_maps.sh

@@ -5,7 +5,7 @@
 # Description: Compresses unreal maps.
 # Description: Compresses unreal maps.
 
 
 local commandaction="Unreal Map Compressor"
 local commandaction="Unreal Map Compressor"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 check.sh
 check.sh
 fn_print_header
 fn_print_header

+ 1 - 1
lgsm/functions/compress_ut99_maps.sh

@@ -5,7 +5,7 @@
 # Description: Compresses unreal maps.
 # Description: Compresses unreal maps.
 
 
 local commandaction="Unreal Map Compressor"
 local commandaction="Unreal Map Compressor"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 check.sh
 check.sh
 fn_print_header
 fn_print_header

+ 1 - 1
lgsm/functions/core_dl.sh

@@ -19,7 +19,7 @@
 
 
 local commandname="DOWNLOAD"
 local commandname="DOWNLOAD"
 local commandaction="Download"
 local commandaction="Download"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_dl_md5(){
 fn_dl_md5(){
 	# Runs MD5 Check if available
 	# Runs MD5 Check if available

+ 5 - 0
lgsm/functions/core_functions.sh

@@ -326,6 +326,11 @@ functionfile="${FUNCNAME}"
 fn_fetch_function
 fn_fetch_function
 }
 }
 
 
+fix_kf2.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
 fix_ut2k4.sh(){
 fix_ut2k4.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
 fn_fetch_function
 fn_fetch_function

+ 2 - 2
lgsm/functions/core_getopt.sh

@@ -4,7 +4,7 @@
 # Website: https://gameservermanagers.com
 # Website: https://gameservermanagers.com
 # Description: getopt arguments.
 # Description: getopt arguments.
 
 
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 ### Define all commands here ###
 ### Define all commands here ###
 ## User commands | Trigger commands | Description
 ## User commands | Trigger commands | Description
@@ -56,7 +56,7 @@ currentopt=( "${cmd_start[@]}" "${cmd_stop[@]}" "${cmd_restart[@]}" "${cmd_monit
 currentopt+=( "${cmd_update_linuxgsm[@]}" )
 currentopt+=( "${cmd_update_linuxgsm[@]}" )
 
 
 # Exclude noupdate games here
 # Exclude noupdate games here
-if [ "${gamename}" != "Battlefield: 1942" ]&&[ "${engine}" != "quake" ]&&[ "${engine}" != "idtech2" ]&&[ "${engine}" != "idtech3" ]&&[ "${engine}" != "iw2.0" ]&&[ "${engine}" != "iw3.0" ]; then
+if [ "${gamename}" != "Battlefield: 1942" ]&&[ "${engine}" != "quake" ]&&[ "${engine}" != "idtech2" ]&&[ "${engine}" != "idtech3" ]&&[ "${engine}" != "iw2.0" ]&&[ "${engine}" != "iw3.0" ]&&[ "${gamename}" != "San Andreas Multiplayer" ]; then
 	currentopt+=( "${cmd_update[@]}" )
 	currentopt+=( "${cmd_update[@]}" )
 	# force update for SteamCMD only or MTA
 	# force update for SteamCMD only or MTA
 	if [ -n "${appid}" ] || [ "${gamename}" == "Multi Theft Auto" ]; then
 	if [ -n "${appid}" ] || [ "${gamename}" == "Multi Theft Auto" ]; then

+ 3 - 13
lgsm/functions/fix.sh

@@ -63,29 +63,19 @@ fi
 
 
 # Fixes that are run on install only.
 # Fixes that are run on install only.
 if [ "${function_selfname}" == "command_install.sh" ]; then
 if [ "${function_selfname}" == "command_install.sh" ]; then
-	if [ "${gamename}" == "Killing Floor" ]; then
 		echo ""
 		echo ""
 		echo "Applying ${gamename} Server Fixes"
 		echo "Applying ${gamename} Server Fixes"
 		echo "================================="
 		echo "================================="
 		sleep 1
 		sleep 1
+	if [ "${gamename}" == "Killing Floor" ]; then
 		fix_kf.sh
 		fix_kf.sh
+	elif [ "${gamename}" == "Killing Floor 2" ]; then
+		fix_kf2.sh
 	elif [ "${gamename}" == "Red Orchestra: Ostfront 41-45" ]; then
 	elif [ "${gamename}" == "Red Orchestra: Ostfront 41-45" ]; then
-		echo ""
-		echo "Applying ${gamename} Server Fixes"
-		echo "================================="
-		sleep 1
 		fix_ro.sh
 		fix_ro.sh
 	elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
 	elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
-		echo ""
-		echo "Applying ${gamename} Server Fixes"
-		echo "================================="
-		sleep 1
 		fix_ut2k4.sh
 		fix_ut2k4.sh
 	elif [ "${gamename}" == "Unreal Tournament" ]; then
 	elif [ "${gamename}" == "Unreal Tournament" ]; then
-		echo ""
-		echo "Applying ${gamename} Server Fixes"
-		echo "================================="
-		sleep 1
 		fix_ut.sh
 		fix_ut.sh
 	fi
 	fi
 fi
 fi

+ 1 - 1
lgsm/functions/fix_arma3.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="FIX"
 local commandname="FIX"
 local commandaction="Fix"
 local commandaction="Fix"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 # Fixes: 20150 Segmentation fault (core dumped) error.
 # Fixes: 20150 Segmentation fault (core dumped) error.
 if [ ! -d "${HOME}/.local/share/Arma 3" ]||[ ! -d "${HOME}/.local/share/Arma 3 - Other Profiles" ]; then
 if [ ! -d "${HOME}/.local/share/Arma 3" ]||[ ! -d "${HOME}/.local/share/Arma 3 - Other Profiles" ]; then

+ 1 - 1
lgsm/functions/fix_csgo.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="FIX"
 local commandname="FIX"
 local commandaction="Fix"
 local commandaction="Fix"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 # Fixes: server not always creating steam_appid.txt file.
 # Fixes: server not always creating steam_appid.txt file.
 if [ ! -f "${serverfiles}/steam_appid.txt" ]; then
 if [ ! -f "${serverfiles}/steam_appid.txt" ]; then

+ 1 - 1
lgsm/functions/fix_dst.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="FIX"
 local commandname="FIX"
 local commandaction="Fix"
 local commandaction="Fix"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 # Fixes: ./dontstarve_dedicated_server_nullrenderer: ./lib32/libcurl-gnutls.so.4: no version information available (required by ./dontstarve_dedicated_server_nullrenderer)
 # Fixes: ./dontstarve_dedicated_server_nullrenderer: ./lib32/libcurl-gnutls.so.4: no version information available (required by ./dontstarve_dedicated_server_nullrenderer)
 # Issue only occures on CentOS as libcurl-gnutls.so.4 is called libcurl.so.4 on CentOS.
 # Issue only occures on CentOS as libcurl-gnutls.so.4 is called libcurl.so.4 on CentOS.

+ 1 - 1
lgsm/functions/fix_glibc.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="FIX"
 local commandname="FIX"
 local commandaction="Fix"
 local commandaction="Fix"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 ## i386
 ## i386
 
 

+ 1 - 1
lgsm/functions/fix_kf.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="FIX"
 local commandname="FIX"
 local commandaction="Fix"
 local commandaction="Fix"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 echo "Applying WebAdmin ROOst.css fix."
 echo "Applying WebAdmin ROOst.css fix."
 echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
 echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"

+ 20 - 0
lgsm/functions/fix_kf2.sh

@@ -0,0 +1,20 @@
+#!/bin/bash
+# LinuxGSM fix_kf3.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+# Description: Resolves various issues with Killing Floor 2.
+
+local commandname="FIX"
+local commandaction="Fix"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
+fn_parms(){
+parms="\"${defaultmap}?Game=KFGameContent.KFGameInfo_VersusSurvival\""
+}
+
+fn_print_information "starting Killing Floor 2 server to generate configs."
+sleep 1
+exitbypass=1
+command_start.sh
+sleep 10
+command_stop.sh

+ 1 - 1
lgsm/functions/fix_mta.sh

@@ -6,7 +6,7 @@
 # Description: Installs the libmysqlclient for database functions on the server
 # Description: Installs the libmysqlclient for database functions on the server
 local commandname="FIX"
 local commandname="FIX"
 local commandaction="Fix"
 local commandaction="Fix"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 if [ ! -f "${lgsmdir}/lib/libmysqlclient.so.16" ]; then
 if [ ! -f "${lgsmdir}/lib/libmysqlclient.so.16" ]; then
 	fixname="libmysqlclient16"
 	fixname="libmysqlclient16"

+ 1 - 1
lgsm/functions/fix_ro.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="FIX"
 local commandname="FIX"
 local commandaction="Fix"
 local commandaction="Fix"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 echo "Applying WebAdmin ROOst.css fix."
 echo "Applying WebAdmin ROOst.css fix."
 echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
 echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"

+ 1 - 1
lgsm/functions/fix_steamcmd.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="FIX"
 local commandname="FIX"
 local commandaction="Fix"
 local commandaction="Fix"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 # Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so.
 # Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so.
 if [ ! -f "${HOME}/.steam/sdk32/steamclient.so" ]; then
 if [ ! -f "${HOME}/.steam/sdk32/steamclient.so" ]; then

+ 1 - 1
lgsm/functions/fix_ut.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="FIX"
 local commandname="FIX"
 local commandaction="Fix"
 local commandaction="Fix"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 #Set Binary Executable
 #Set Binary Executable
 echo "chmod +x ${executabledir}/${executable}"
 echo "chmod +x ${executabledir}/${executable}"

+ 1 - 1
lgsm/functions/fix_ut2k4.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="FIX"
 local commandname="FIX"
 local commandaction="Fix"
 local commandaction="Fix"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 echo "applying WebAdmin ut2003.css fix."
 echo "applying WebAdmin ut2003.css fix."
 echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
 echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"

+ 1 - 1
lgsm/functions/gsquery.py

@@ -17,7 +17,7 @@ class PythonGSQ:
         self.server_response_timeout = 5
         self.server_response_timeout = 5
         self.default_buffer_length = 1024
         self.default_buffer_length = 1024
         #
         #
-        sourcequery=['madness','quakelive','realvirtuality','refractor','source','goldsource','spark','unity3d']
+        sourcequery=['madness','quakelive','realvirtuality','refractor','source','goldsource','spark','starbound','unity3d']
         idtech2query=['idtech3','quake','iw3.0']
         idtech2query=['idtech3','quake','iw3.0']
         idtech3query=['idtech2','iw2.0']
         idtech3query=['idtech2','iw2.0']
         if self.option.engine in sourcequery:
         if self.option.engine in sourcequery:

+ 32 - 1
lgsm/functions/info_config.sh

@@ -5,7 +5,7 @@
 # Website: https://gameservermanagers.com
 # Website: https://gameservermanagers.com
 # Description: Gets specific details from config files.
 # Description: Gets specific details from config files.
 
 
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 ## Examples of filtering to get info from config files
 ## Examples of filtering to get info from config files
 # sed 's/foo//g' - remove foo
 # sed 's/foo//g' - remove foo
@@ -455,6 +455,8 @@ fn_info_config_source(){
 fn_info_config_starbound(){
 fn_info_config_starbound(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 	if [ ! -f "${servercfgfullpath}" ]; then
 		servername="${unavailable}"
 		servername="${unavailable}"
+		queryenabled="${unavailable}"
+		rconenabled="${unavailable}"
 		rconpassword="${unavailable}"
 		rconpassword="${unavailable}"
 		port="21025"
 		port="21025"
 		queryport="21025"
 		queryport="21025"
@@ -462,6 +464,8 @@ fn_info_config_starbound(){
 		maxplayers="8"
 		maxplayers="8"
 	else
 	else
 		servername=$(grep "serverName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e 's/serverName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
 		servername=$(grep "serverName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e 's/serverName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		queryenabled=$(grep "runQueryServer" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e 's/runQueryServer//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		rconenabled=$(grep "runRconServer" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e 's/runRconServer//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
 		rconpassword=$(grep "rconServerPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e 's/rconServerPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
 		rconpassword=$(grep "rconServerPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e 's/rconServerPassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
 		port=$(grep "gameServerPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
 		port=$(grep "gameServerPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
 		queryport=$(grep "queryServerPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
 		queryport=$(grep "queryServerPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
@@ -470,6 +474,8 @@ fn_info_config_starbound(){
 
 
 		# Not Set
 		# Not Set
 		servername=${servername:-"NOT SET"}
 		servername=${servername:-"NOT SET"}
+		queryenabled=${queryenabled:-"NOT SET"}
+		rconenabled==${rconenabled:-"NOT SET"}
 		rconpassword=${rconpassword:-"NOT SET"}
 		rconpassword=${rconpassword:-"NOT SET"}
 		port=${port:-"21025"}
 		port=${port:-"21025"}
 		queryport=${queryport:-"21025"}
 		queryport=${queryport:-"21025"}
@@ -521,6 +527,27 @@ fn_info_config_mumble(){
 	fi
 	fi
 }
 }
 
 
+fn_info_config_samp(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		servername="unnamed server"
+		serverpassword="${unavailable}"
+		rconpassword="${unavailable}"
+		port="7777"
+		maxplayers="50"
+	else
+		servername=$(grep "hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/hostname//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		rconpassword=$(grep "rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/^rcon_password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		port=$(grep "port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+		maxplayers=$(grep "maxplayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+
+		# Not Set
+		servername=${servername:-"NOT SET"}
+		rconpassword=${rconpassword:-"NOT SET"}
+		port=${port:-"8303"}
+		maxplayers=${maxplayers:-"12"}
+	fi
+}
+
 fn_info_config_teeworlds(){
 fn_info_config_teeworlds(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 	if [ ! -f "${servercfgfullpath}" ]; then
 		servername="unnamed server"
 		servername="unnamed server"
@@ -895,8 +922,12 @@ elif [ "${engine}" == "starbound" ]; then
 # TeamSpeak 3
 # TeamSpeak 3
 elif [ "${gamename}" == "TeamSpeak 3" ]; then
 elif [ "${gamename}" == "TeamSpeak 3" ]; then
 	fn_info_config_teamspeak3
 	fn_info_config_teamspeak3
+# Mumble
 elif [ "${gamename}" == "Mumble" ]; then
 elif [ "${gamename}" == "Mumble" ]; then
 	fn_info_config_mumble
 	fn_info_config_mumble
+# San Andreas Multiplayer
+elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
+	fn_info_config_samp
 # Teeworlds
 # Teeworlds
 elif [ "${engine}" == "teeworlds" ]; then
 elif [ "${engine}" == "teeworlds" ]; then
 	fn_info_config_teeworlds
 	fn_info_config_teeworlds

+ 4 - 2
lgsm/functions/info_distro.sh

@@ -5,7 +5,7 @@
 # Description: Variables providing useful info on the Operating System such as disk and performace info.
 # Description: Variables providing useful info on the Operating System such as disk and performace info.
 # Used for command_details.sh, command_debug.sh and alert.sh.
 # Used for command_details.sh, command_debug.sh and alert.sh.
 
 
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 ### Distro information
 ### Distro information
 
 
@@ -135,4 +135,6 @@ if [ -d "${backupdir}" ]; then
 fi
 fi
 
 
 # External IP address
 # External IP address
-extip=$(curl -m 3 ifconfig.co 2>/dev/null)
+if [ -z "${extip}" ];then
+	extip=$(curl -m 3 ifconfig.co 2>/dev/null)
+fi

+ 4 - 1
lgsm/functions/info_glibc.sh

@@ -4,7 +4,7 @@
 # Website: https://gameservermanagers.com
 # Website: https://gameservermanagers.com
 # Description: Stores details on servers Glibc requirements.
 # Description: Stores details on servers Glibc requirements.
 
 
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 if [ "${gamename}" == "ARK: Survival Evolved" ]; then
 if [ "${gamename}" == "ARK: Survival Evolved" ]; then
 	glibcrequired="2.15"
 	glibcrequired="2.15"
@@ -89,6 +89,9 @@ elif [ "${gamename}" == "Quake 3: Arena" ]; then
 elif [ "${gamename}" == "Quake Live" ]; then
 elif [ "${gamename}" == "Quake Live" ]; then
 	glibcrequired="2.15"
 	glibcrequired="2.15"
 	glibcfix="no"
 	glibcfix="no"
+elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
+	glibcrequired="2.3"
+	glibcfix="no"
 elif [ "${gamename}" == "Squad" ]; then
 elif [ "${gamename}" == "Squad" ]; then
 	glibcrequired="2.17"
 	glibcrequired="2.17"
 	glibcfix="no"
 	glibcfix="no"

+ 22 - 0
lgsm/functions/info_messages.sh

@@ -146,6 +146,16 @@ fn_info_message_gameserver(){
 			echo -e "${blue}Server password:\t${default}${serverpassword}"
 			echo -e "${blue}Server password:\t${default}${serverpassword}"
 		fi
 		fi
 
 
+		# Query enabled (Starbound)
+		if [ -n "${queryenabled}" ]; then
+			echo -e "${blue}Query enabled:\t${default}${rconpassword}"
+		fi
+
+		# RCON enabled (Starbound)
+		if [ -n "${rconenabled}" ]; then
+			echo -e "${blue}RCON enabled:\t${default}${rconpassword}"
+		fi
+
 		# RCON password
 		# RCON password
 		if [ -n "${rconpassword}" ]; then
 		if [ -n "${rconpassword}" ]; then
 			echo -e "${blue}RCON password:\t${default}${rconpassword}"
 			echo -e "${blue}RCON password:\t${default}${rconpassword}"
@@ -707,6 +717,16 @@ fn_info_message_rust(){
 	} | column -s $'\t' -t
 	} | column -s $'\t' -t
 }
 }
 
 
+fn_info_message_samp(){
+	echo -e "netstat -atunp | grep samp03svr"
+	echo -e ""
+	{
+		echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+		echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
+	} | column -s $'\t' -t
+}
+
+
 fn_info_message_seriousengine35(){
 fn_info_message_seriousengine35(){
 	echo -e "netstat -atunp | grep Sam3_Dedicate"
 	echo -e "netstat -atunp | grep Sam3_Dedicate"
 	echo -e ""
 	echo -e ""
@@ -977,6 +997,8 @@ fn_info_message_select_engine(){
 		fn_info_message_quake3
 		fn_info_message_quake3
 	elif [ "${gamename}" == "Quake Live" ]; then
 	elif [ "${gamename}" == "Quake Live" ]; then
 		fn_info_message_quakelive
 		fn_info_message_quakelive
+	elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
+		fn_info_message_samp
 	elif [ "${gamename}" == "Squad" ]; then
 	elif [ "${gamename}" == "Squad" ]; then
 		fn_info_message_squad
 		fn_info_message_squad
 	elif [ "${gamename}" == "TeamSpeak 3" ]; then
 	elif [ "${gamename}" == "TeamSpeak 3" ]; then

+ 1 - 1
lgsm/functions/info_parms.sh

@@ -4,7 +4,7 @@
 # Website: https://gameservermanagers.com
 # Website: https://gameservermanagers.com
 # Description: If specific parms are not set then this will be displayed in details.
 # Description: If specific parms are not set then this will be displayed in details.
 
 
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 ## Examples of filtering to get info from config files
 ## Examples of filtering to get info from config files
 # sed 's/foo//g' - remove foo
 # sed 's/foo//g' - remove foo

+ 1 - 1
lgsm/functions/install_complete.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="INSTALL"
 local commandname="INSTALL"
 local commandaction="Install"
 local commandaction="Install"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 echo "================================="
 echo "================================="
 echo "Install Complete!"
 echo "Install Complete!"

+ 12 - 12
lgsm/functions/install_config.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="INSTALL"
 local commandname="INSTALL"
 local commandaction="Install"
 local commandaction="Install"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 # Checks if server cfg dir exists, creates it if it doesn't
 # Checks if server cfg dir exists, creates it if it doesn't
 fn_check_cfgdir(){
 fn_check_cfgdir(){
@@ -19,6 +19,11 @@ fn_check_cfgdir(){
 
 
 # Downloads default configs from Game-Server-Configs repo to lgsm/config-default
 # Downloads default configs from Game-Server-Configs repo to lgsm/config-default
 fn_fetch_default_config(){
 fn_fetch_default_config(){
+	echo ""
+	echo "Downloading ${gamename} Configs"
+	echo "================================="
+	echo "default configs from https://github.com/GameServerManagers/Game-Server-Configs"
+	sleep 1
 	mkdir -p "${lgsmdir}/config-default/config-game"
 	mkdir -p "${lgsmdir}/config-default/config-game"
 	githuburl="https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/master"
 	githuburl="https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/master"
 	for config in "${array_configs[@]}"; do
 	for config in "${array_configs[@]}"; do
@@ -118,11 +123,6 @@ fn_set_dst_config_vars(){
 	echo ""
 	echo ""
 }
 }
 
 
-echo ""
-echo "Downloading ${gamename} Config"
-echo "================================="
-echo "default configs from https://github.com/GameServerManagers/Game-Server-Configs"
-sleep 2
 if [ "${gamename}" == "7 Days To Die" ]; then
 if [ "${gamename}" == "7 Days To Die" ]; then
 	gamedirname="7DaysToDie"
 	gamedirname="7DaysToDie"
 	array_configs+=( serverconfig.xml )
 	array_configs+=( serverconfig.xml )
@@ -383,10 +383,6 @@ elif [ "${gamename}" == "Mumble" ]; then
 	array_configs+=( murmur.ini )
 	array_configs+=( murmur.ini )
 	fn_fetch_default_config
 	fn_fetch_default_config
 	fn_default_config_remote
 	fn_default_config_remote
-elif [ "${gamename}" == "Natural Selection 2" ]; then
-	:
-elif [ "${gamename}" == "NS2: Combat" ]; then
-	:
 elif [ "${gamename}" == "Pirates, Vikings, and Knights II" ]; then
 elif [ "${gamename}" == "Pirates, Vikings, and Knights II" ]; then
 	gamedirname="PiratesVikingandKnightsII"
 	gamedirname="PiratesVikingandKnightsII"
 	array_configs+=( server.cfg )
 	array_configs+=( server.cfg )
@@ -430,8 +426,6 @@ elif [ "${gamename}" == "QuakeWorld" ]; then
 	fn_fetch_default_config
 	fn_fetch_default_config
 	fn_default_config_remote
 	fn_default_config_remote
 	fn_set_config_vars
 	fn_set_config_vars
-elif [ "${gamename}" == "Red Orchestra: Ostfront 41-45" ]; then
-	:
 elif [ "${gamename}" == "Ricochet" ]; then
 elif [ "${gamename}" == "Ricochet" ]; then
 	gamedirname="Ricochet"
 	gamedirname="Ricochet"
 	array_configs+=( server.cfg )
 	array_configs+=( server.cfg )
@@ -462,6 +456,12 @@ elif [ "${gamename}" == "Starbound" ]; then
 	fn_fetch_default_config
 	fn_fetch_default_config
 	fn_default_config_remote
 	fn_default_config_remote
 	fn_set_config_vars
 	fn_set_config_vars
+elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
+	gamedirname="SanAndreasMultiplayer"
+	array_configs+=( server.cfg )
+	fn_fetch_default_config
+	fn_default_config_remote
+	fn_set_config_vars
 elif [ "${gamename}" == "Sven Co-op" ]; then
 elif [ "${gamename}" == "Sven Co-op" ]; then
 	gamedirname="SvenCoop"
 	gamedirname="SvenCoop"
 	array_configs+=( server.cfg )
 	array_configs+=( server.cfg )

+ 1 - 1
lgsm/functions/install_dst_token.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="INSTALL"
 local commandname="INSTALL"
 local commandaction="Install"
 local commandaction="Install"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 echo ""
 echo ""
 echo "Enter ${gamename} Cluster Token"
 echo "Enter ${gamename} Cluster Token"

+ 1 - 1
lgsm/functions/install_gslt.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="INSTALL"
 local commandname="INSTALL"
 local commandaction="Install"
 local commandaction="Install"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 echo ""
 echo ""
 echo "Game Server Login Token"
 echo "Game Server Login Token"

+ 1 - 1
lgsm/functions/install_header.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="INSTALL"
 local commandname="INSTALL"
 local commandaction="Install"
 local commandaction="Install"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 clear
 clear
 echo "================================="
 echo "================================="

+ 1 - 1
lgsm/functions/install_logs.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="INSTALL"
 local commandname="INSTALL"
 local commandaction="Install"
 local commandaction="Install"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 if [ "${checklogs}" != "1" ]; then
 if [ "${checklogs}" != "1" ]; then
 	echo ""
 	echo ""

+ 1 - 1
lgsm/functions/install_mta_resources.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="INSTALL"
 local commandname="INSTALL"
 local commandaction="Install"
 local commandaction="Install"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_print_information_nl "${gamename} will not function without resources!"
 fn_print_information_nl "${gamename} will not function without resources!"
 echo "	* install default resources using ./${selfname} install-default-resources"
 echo "	* install default resources using ./${selfname} install-default-resources"

+ 1 - 1
lgsm/functions/install_retry.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="INSTALL"
 local commandname="INSTALL"
 local commandaction="Install"
 local commandaction="Install"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 if fn_prompt_yn "Retry install?" Y; then
 if fn_prompt_yn "Retry install?" Y; then
 	command_install.sh; exit
 	command_install.sh; exit

+ 1 - 1
lgsm/functions/install_server_dir.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="INSTALL"
 local commandname="INSTALL"
 local commandaction="Install"
 local commandaction="Install"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 echo ""
 echo ""
 echo "Server Directory"
 echo "Server Directory"

+ 3 - 1
lgsm/functions/install_server_files.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="INSTALL"
 local commandname="INSTALL"
 local commandaction="Install"
 local commandaction="Install"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_install_server_files(){
 fn_install_server_files(){
 	if [ "${gamename}" == "Battlefield: 1942" ]; then
 	if [ "${gamename}" == "Battlefield: 1942" ]; then
@@ -39,6 +39,8 @@ fn_install_server_files(){
 		remote_fileurl="http://files.gameservermanagers.com/UnrealTournament3/UT3-linux-server-2.1.tar.bz2"; local_filedir="${tmpdir}"; local_filename="UT3-linux-server-2.1.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="2527437b46f1b47f20228d27d72395a6"
 		remote_fileurl="http://files.gameservermanagers.com/UnrealTournament3/UT3-linux-server-2.1.tar.bz2"; local_filedir="${tmpdir}"; local_filename="UT3-linux-server-2.1.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="2527437b46f1b47f20228d27d72395a6"
 	elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
 	elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
 		remote_fileurl="http://files.gameservermanagers.com/WolfensteinEnemyTerritory/enemy-territory.260b.tar.bz2"; local_filedir="${tmpdir}"; local_filename="enemy-territory.260b.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="f833f514bfcdd46b42c111f83350c5a7"
 		remote_fileurl="http://files.gameservermanagers.com/WolfensteinEnemyTerritory/enemy-territory.260b.tar.bz2"; local_filedir="${tmpdir}"; local_filename="enemy-territory.260b.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="f833f514bfcdd46b42c111f83350c5a7"
+	elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
+		remote_fileurl="http://files.sa-mp.com/samp037svr_R2-1.tar.gz"; local_filedir="${tmpdir}"; local_filename="samp037svr_R2-1.tar.gz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="93705e165550c97484678236749198a4"
 	fi
 	fi
 	fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
 	fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
 	fn_dl_extract "${local_filedir}" "${local_filename}" "${serverfiles}"
 	fn_dl_extract "${local_filedir}" "${local_filename}" "${serverfiles}"

+ 1 - 1
lgsm/functions/install_squad_license.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="INSTALL"
 local commandname="INSTALL"
 local commandaction="Install"
 local commandaction="Install"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 echo ""
 echo ""
 echo "Squad Server License"
 echo "Squad Server License"

+ 1 - 1
lgsm/functions/install_ts3db.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="INSTALL"
 local commandname="INSTALL"
 local commandaction="Install"
 local commandaction="Install"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_install_ts3db_mariadb(){
 fn_install_ts3db_mariadb(){
 	echo ""
 	echo ""

+ 1 - 1
lgsm/functions/install_ut2k4_key.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="INSTALL"
 local commandname="INSTALL"
 local commandaction="Install"
 local commandaction="Install"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 echo ""
 echo ""
 echo "Enter ${gamename} CD Key"
 echo "Enter ${gamename} CD Key"

+ 1 - 1
lgsm/functions/logs.sh

@@ -67,7 +67,7 @@ if [ $(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; then
 		smcount=$(find "${commonlogs}"/ -type f -mtime +"${logdays}"|wc -l)
 		smcount=$(find "${commonlogs}"/ -type f -mtime +"${logdays}"|wc -l)
 		find "${commonlogs}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 		find "${commonlogs}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 	fi
 	fi
-	if [ -d ${commonsourcelogs} ]; then
+	if [ -d "${commonsourcelogs}" ]; then
 		find "${commonsourcelogs}"/* -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
 		find "${commonsourcelogs}"/* -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
 		smcount=$(find "${commonsourcelogs}"/* -type f -mtime +"${logdays}"|wc -l)
 		smcount=$(find "${commonsourcelogs}"/* -type f -mtime +"${logdays}"|wc -l)
 		find "${commonsourcelogs}"/* -mtime +"${logdays}" -type f -exec rm -f {} \;
 		find "${commonsourcelogs}"/* -mtime +"${logdays}" -type f -exec rm -f {} \;

+ 1 - 1
lgsm/functions/mods_core.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="MODS"
 local commandname="MODS"
 local commandaction="addons/mods"
 local commandaction="addons/mods"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 # Files and Directories
 # Files and Directories
 modsdir="${lgsmdir}/mods"
 modsdir="${lgsmdir}/mods"

+ 1 - 1
lgsm/functions/mods_list.sh

@@ -10,7 +10,7 @@
 
 
 local commandname="MODS"
 local commandname="MODS"
 local commandaction="List Mods"
 local commandaction="List Mods"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 # Get a proper URL for mods that don't provide a good one (optional)
 # Get a proper URL for mods that don't provide a good one (optional)
 fn_script_log_info "Retrieving latest mods URLs"
 fn_script_log_info "Retrieving latest mods URLs"

+ 1 - 1
lgsm/functions/monitor_gsquery.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="MONITOR"
 local commandname="MONITOR"
 local commandaction="Monitor"
 local commandaction="Monitor"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 # Downloads gsquery.py if missing
 # Downloads gsquery.py if missing
 if [ ! -f "${functionsdir}/gsquery.py" ]; then
 if [ ! -f "${functionsdir}/gsquery.py" ]; then

+ 1 - 1
lgsm/functions/update_factorio.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="UPDATE"
 local commandname="UPDATE"
 local commandaction="Update"
 local commandaction="Update"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_update_factorio_dl(){
 fn_update_factorio_dl(){
 	fn_fetch_file "https://www.factorio.com/get-download/${availablebuild}/headless/${factorioarch}" "${tmpdir}" "factorio_headless_${factorioarch}-${availablebuild}.tar.gz"
 	fn_fetch_file "https://www.factorio.com/get-download/${availablebuild}/headless/${factorioarch}" "${tmpdir}" "factorio_headless_${factorioarch}-${availablebuild}.tar.gz"

+ 1 - 1
lgsm/functions/update_minecraft.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="UPDATE"
 local commandname="UPDATE"
 local commandaction="Update"
 local commandaction="Update"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_update_dl(){
 fn_update_dl(){
 	fn_fetch_file "https://s3.amazonaws.com/Minecraft.Download/versions/${availablebuild}/minecraft_server.${availablebuild}.jar" "${tmpdir}" "minecraft_server.${availablebuild}.jar"
 	fn_fetch_file "https://s3.amazonaws.com/Minecraft.Download/versions/${availablebuild}/minecraft_server.${availablebuild}.jar" "${tmpdir}" "minecraft_server.${availablebuild}.jar"

+ 1 - 1
lgsm/functions/update_mta.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="UPDATE"
 local commandname="UPDATE"
 local commandaction="Update"
 local commandaction="Update"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_update_mta_dl(){
 fn_update_mta_dl(){
 	fn_fetch_file "http://linux.mtasa.com/dl/${numversion}/multitheftauto_linux_x64-${fullversion}.tar.gz" "${tmpdir}" "multitheftauto_linux_x64-${fullversion}.tar.gz"
 	fn_fetch_file "http://linux.mtasa.com/dl/${numversion}/multitheftauto_linux_x64-${fullversion}.tar.gz" "${tmpdir}" "multitheftauto_linux_x64-${fullversion}.tar.gz"

+ 1 - 1
lgsm/functions/update_mumble.sh

@@ -7,7 +7,7 @@
 
 
 local commandname="UPDATE"
 local commandname="UPDATE"
 local commandaction="Update"
 local commandaction="Update"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_update_mumble_dl(){
 fn_update_mumble_dl(){
 	fn_fetch_file "https://github.com/mumble-voip/mumble/releases/download/${availablebuild}/murmur-static_${mumblearch}-${availablebuild}.tar.bz2" "${tmpdir}" "murmur-static_${mumblearch}-${availablebuild}.tar.bz2"
 	fn_fetch_file "https://github.com/mumble-voip/mumble/releases/download/${availablebuild}/murmur-static_${mumblearch}-${availablebuild}.tar.bz2" "${tmpdir}" "murmur-static_${mumblearch}-${availablebuild}.tar.bz2"

+ 2 - 2
lgsm/functions/update_steamcmd.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="UPDATE"
 local commandname="UPDATE"
 local commandaction="Update"
 local commandaction="Update"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 check.sh
 check.sh
 
 
@@ -102,7 +102,7 @@ fn_update_request_log(){
 	fn_print_dots "Checking for update: Server logs"
 	fn_print_dots "Checking for update: Server logs"
 	fn_script_log_info "Checking for update: Server logs"
 	fn_script_log_info "Checking for update: Server logs"
 	sleep 1
 	sleep 1
-	if [ -f ${consolelog} ]; then
+	if [ -f "${consolelog}" ]; then
 		requestrestart=$(grep -Ec "MasterRequestRestart" "${consolelog}")
 		requestrestart=$(grep -Ec "MasterRequestRestart" "${consolelog}")
 	else
 	else
 		requestrestart="0"
 		requestrestart="0"

+ 1 - 1
lgsm/functions/update_ts3.sh

@@ -6,7 +6,7 @@
 
 
 local commandname="UPDATE"
 local commandname="UPDATE"
 local commandaction="Update"
 local commandaction="Update"
-local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 
 fn_update_ts3_dl(){
 fn_update_ts3_dl(){
 	fn_fetch_file "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"
 	fn_fetch_file "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"

+ 4 - 4
linuxgsm.sh

@@ -20,11 +20,11 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170926"
+version="171014"
 shortname="core"
 shortname="core"
 gameservername="core"
 gameservername="core"
-rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
-selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
+selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 servicename="${selfname}"
 servicename="${selfname}"
 lockselfname=".${servicename}.lock"
 lockselfname=".${servicename}.lock"
 lgsmdir="${rootdir}/lgsm"
 lgsmdir="${rootdir}/lgsm"
@@ -337,7 +337,7 @@ else
 			echo -e "\e[0;32mOK\e[0m"
 			echo -e "\e[0;32mOK\e[0m"
 		fi
 		fi
 	else
 	else
-		function_file_diff=$(diff -q ${configdirdefault}/config-lgsm/${gameservername}/_default.cfg ${configdirserver}/_default.cfg)
+		function_file_diff=$(diff -q "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg")
 		if [ "${function_file_diff}" != "" ]; then
 		if [ "${function_file_diff}" != "" ]; then
 			fn_print_warn_nl "_default.cfg has been altered. reloading config."
 			fn_print_warn_nl "_default.cfg has been altered. reloading config."
 			echo -ne "    copying _default.cfg...\c"
 			echo -ne "    copying _default.cfg...\c"

+ 65 - 17
tests/tests_jc2server.sh

@@ -16,10 +16,10 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170619"
+version="171014"
 shortname="jc2"
 shortname="jc2"
 gameservername="jc2server"
 gameservername="jc2server"
-rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
+rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
 selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 servicename="${selfname}"
 servicename="${selfname}"
 lockselfname=".${servicename}.lock"
 lockselfname=".${servicename}.lock"
@@ -423,7 +423,7 @@ fn_setstatus(){
 
 
 # End of every test will expect the result to either pass or fail
 # End of every test will expect the result to either pass or fail
 # If the script does not do as intended the whole test will fail
 # If the script does not do as intended the whole test will fail
-# if excpecting a pass
+# if expecting a pass
 fn_test_result_pass(){
 fn_test_result_pass(){
 	if [ $? != 0 ]; then
 	if [ $? != 0 ]; then
 		echo "================================="
 		echo "================================="
@@ -441,7 +441,7 @@ fn_test_result_pass(){
 	fi
 	fi
 }
 }
 
 
-# if excpecting a fail
+# if expecting a fail
 fn_test_result_fail(){
 fn_test_result_fail(){
 	if [ $? == 0 ]; then
 	if [ $? == 0 ]; then
 		echo "================================="
 		echo "================================="
@@ -528,7 +528,6 @@ echo "Command: ./jc2server auto-install"
 (fn_autoinstall)
 (fn_autoinstall)
 fn_test_result_pass
 fn_test_result_pass
 
 
-
 echo ""
 echo ""
 echo "3.1 - start"
 echo "3.1 - start"
 echo "================================="
 echo "================================="
@@ -701,16 +700,14 @@ fn_setstatus
 fn_test_result_pass
 fn_test_result_pass
 
 
 echo ""
 echo ""
-echo "4.9 - update-functions"
+echo "Inserting IP address"
 echo "================================="
 echo "================================="
 echo "Description:"
 echo "Description:"
-echo "runs update-functions."
-echo ""
-echo "Command: ./jc2server update-functions"
-requiredstatus="OFFLINE"
-fn_setstatus
-(command_update_functions.sh)
-fn_test_result_pass
+echo "Inserting Travis IP in to config."
+echo "Allows monitor to work"
+travisip=$(ip -o -4 addr|grep eth0|awk '{print $4}'|grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|grep -v 127.0.0)
+sed -i "/BindIP/c\BindIP                      = \"${travisip}\"," "${serverfiles}/config.lua"
+echo "IP: ${travisip}"
 
 
 echo ""
 echo ""
 echo "5.1 - monitor - online"
 echo "5.1 - monitor - online"
@@ -723,7 +720,6 @@ fn_setstatus
 (command_monitor.sh)
 (command_monitor.sh)
 fn_test_result_pass
 fn_test_result_pass
 
 
-
 echo ""
 echo ""
 echo "5.2 - monitor - offline - with lockfile"
 echo "5.2 - monitor - offline - with lockfile"
 echo "================================="
 echo "================================="
@@ -737,7 +733,6 @@ date > "${rootdir}/${lockselfname}"
 (command_monitor.sh)
 (command_monitor.sh)
 fn_test_result_pass
 fn_test_result_pass
 
 
-
 echo ""
 echo ""
 echo "5.3 - monitor - offline - no lockfile"
 echo "5.3 - monitor - offline - no lockfile"
 echo "================================="
 echo "================================="
@@ -777,6 +772,61 @@ fn_setstatus
 (command_details.sh)
 (command_details.sh)
 fn_test_result_pass
 fn_test_result_pass
 
 
+echo ""
+echo "6.1 - post details"
+echo "================================="
+echo "Description:"
+echo "post details."
+echo "Command: ./jc2server postdetails"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_postdetails.sh)
+fn_test_result_pass
+
+echo ""
+echo "7.0 - backup"
+echo "================================="
+echo "Description:"
+echo "run a backup."
+echo "Command: ./jc2server backup"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_backup.sh)
+fn_test_result_pass
+
+echo ""
+echo "8.0 - dev - detect glibc"
+echo "================================="
+echo "Description:"
+echo "detect glibc."
+echo "Command: ./jc2server detect-glibc"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_dev_detect_glibc.sh)
+fn_test_result_pass
+
+echo ""
+echo "8.1 - dev - detect ldd"
+echo "================================="
+echo "Description:"
+echo "detect ldd."
+echo "Command: ./jc2server detect-ldd"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_dev_detect_ldd.sh)
+fn_test_result_pass
+
+echo ""
+echo "8.2 - dev - detect deps"
+echo "================================="
+echo "Description:"
+echo "detect dependencies."
+echo "Command: ./jc2server detect-deps"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_dev_detect_deps.sh)
+fn_test_result_pass
+
 echo ""
 echo ""
 echo "================================="
 echo "================================="
 echo "Server Tests - Complete!"
 echo "Server Tests - Complete!"
@@ -784,8 +834,6 @@ echo "Using: ${gamename}"
 echo "================================="
 echo "================================="
 requiredstatus="OFFLINE"
 requiredstatus="OFFLINE"
 fn_setstatus
 fn_setstatus
-sleep 1
 fn_print_info "Tidying up directories."
 fn_print_info "Tidying up directories."
-sleep 1
 rm -rfv "${serverfiles}"
 rm -rfv "${serverfiles}"
 core_exit.sh
 core_exit.sh

+ 60 - 23
tests/tests_ts3server.sh

@@ -16,10 +16,10 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="170619"
+version="171014"
 shortname="ts3"
 shortname="ts3"
 gameservername="ts3server"
 gameservername="ts3server"
-rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
+rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
 selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 servicename="${selfname}"
 servicename="${selfname}"
 lockselfname=".${servicename}.lock"
 lockselfname=".${servicename}.lock"
@@ -423,7 +423,7 @@ fn_setstatus(){
 
 
 # End of every test will expect the result to either pass or fail
 # End of every test will expect the result to either pass or fail
 # If the script does not do as intended the whole test will fail
 # If the script does not do as intended the whole test will fail
-# if excpecting a pass
+# if expecting a pass
 fn_test_result_pass(){
 fn_test_result_pass(){
 	if [ $? != 0 ]; then
 	if [ $? != 0 ]; then
 		echo "================================="
 		echo "================================="
@@ -441,7 +441,7 @@ fn_test_result_pass(){
 	fi
 	fi
 }
 }
 
 
-# if excpecting a fail
+# if expecting a fail
 fn_test_result_fail(){
 fn_test_result_fail(){
 	if [ $? == 0 ]; then
 	if [ $? == 0 ]; then
 		echo "================================="
 		echo "================================="
@@ -528,7 +528,6 @@ echo "Command: ./ts3server auto-install"
 (fn_autoinstall)
 (fn_autoinstall)
 fn_test_result_pass
 fn_test_result_pass
 
 
-
 echo ""
 echo ""
 echo "3.1 - start"
 echo "3.1 - start"
 echo "================================="
 echo "================================="
@@ -606,29 +605,16 @@ fn_setstatus
 (command_restart.sh)
 (command_restart.sh)
 fn_test_result_pass
 fn_test_result_pass
 
 
-echo ""
 echo "4.1 - update"
 echo "4.1 - update"
 echo "================================="
 echo "================================="
 echo "Description:"
 echo "Description:"
 echo "check for updates."
 echo "check for updates."
-echo "Command: ./jc2server update"
+echo "Command: ./ts3server update"
 requiredstatus="OFFLINE"
 requiredstatus="OFFLINE"
 fn_setstatus
 fn_setstatus
 (command_update.sh)
 (command_update.sh)
 fn_test_result_pass
 fn_test_result_pass
 
 
-echo ""
-echo "4.2 - update-functions"
-echo "================================="
-echo "Description:"
-echo "runs update-functions."
-echo ""
-echo "Command: ./jc2server update-functions"
-requiredstatus="OFFLINE"
-fn_setstatus
-(command_update_functions.sh)
-fn_test_result_pass
-
 echo ""
 echo ""
 echo "5.1 - monitor - online"
 echo "5.1 - monitor - online"
 echo "================================="
 echo "================================="
@@ -640,7 +626,6 @@ fn_setstatus
 (command_monitor.sh)
 (command_monitor.sh)
 fn_test_result_pass
 fn_test_result_pass
 
 
-
 echo ""
 echo ""
 echo "5.2 - monitor - offline - with lockfile"
 echo "5.2 - monitor - offline - with lockfile"
 echo "================================="
 echo "================================="
@@ -654,7 +639,6 @@ date > "${rootdir}/${lockselfname}"
 (command_monitor.sh)
 (command_monitor.sh)
 fn_test_result_pass
 fn_test_result_pass
 
 
-
 echo ""
 echo ""
 echo "5.3 - monitor - offline - no lockfile"
 echo "5.3 - monitor - offline - no lockfile"
 echo "================================="
 echo "================================="
@@ -677,6 +661,61 @@ fn_setstatus
 (command_details.sh)
 (command_details.sh)
 fn_test_result_pass
 fn_test_result_pass
 
 
+echo ""
+echo "6.1 - post details"
+echo "================================="
+echo "Description:"
+echo "post details."
+echo "Command: ./jc2server postdetails"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_postdetails.sh)
+fn_test_result_pass
+
+echo ""
+echo "7.0 - backup"
+echo "================================="
+echo "Description:"
+echo "run a backup."
+echo "Command: ./jc2server backup"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_backup.sh)
+fn_test_result_pass
+
+echo ""
+echo "8.0 - dev - detect glibc"
+echo "================================="
+echo "Description:"
+echo "detect glibc."
+echo "Command: ./jc2server detect-glibc"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_dev_detect_glibc.sh)
+fn_test_result_pass
+
+echo ""
+echo "8.1 - dev - detect ldd"
+echo "================================="
+echo "Description:"
+echo "detect ldd."
+echo "Command: ./jc2server detect-ldd"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_dev_detect_ldd.sh)
+fn_test_result_pass
+
+echo ""
+echo "8.2 - dev - detect deps"
+echo "================================="
+echo "Description:"
+echo "detect dependencies."
+echo "Command: ./jc2server detect-deps"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_dev_detect_deps.sh)
+fn_test_result_pass
+
 echo ""
 echo ""
 echo "================================="
 echo "================================="
 echo "Server Tests - Complete!"
 echo "Server Tests - Complete!"
@@ -684,8 +723,6 @@ echo "Using: ${gamename}"
 echo "================================="
 echo "================================="
 requiredstatus="OFFLINE"
 requiredstatus="OFFLINE"
 fn_setstatus
 fn_setstatus
-sleep 1
 fn_print_info "Tidying up directories."
 fn_print_info "Tidying up directories."
-sleep 1
 rm -rfv "${serverfiles}"
 rm -rfv "${serverfiles}"
 core_exit.sh
 core_exit.sh