From d54cb6e31a7513eab79ca4af41823cb49b872ea0 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 19:55:09 +0100 Subject: [PATCH 01/12] Added force-update to unreal2 --- functions/fn_getopt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/functions/fn_getopt b/functions/fn_getopt index 2d0448c2d..0599a94f7 100644 --- a/functions/fn_getopt +++ b/functions/fn_getopt @@ -2,7 +2,7 @@ # LGSM fn_getopt function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -# Version: 060515 +# Version: 190515 # Description: getopt arguments. @@ -114,6 +114,12 @@ case "$getopt" in fn_restart;; update) fn_update_check;; + force-update) + forceupdate=1; + fn_update_check;; + update-restart) + forceupdate=1; + fn_update_check;; validate) fn_validate;; monitor) From 49f0efadc892212a64127989b9fc33351a801fb6 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 20:00:16 +0100 Subject: [PATCH 02/12] Added update functions option This new option will update the functions to the newest version by simply deleting the contents of the functions dir --- functions/fn_getopt | 20 +++++++++++++++----- functions/fn_update_funtions | 9 +++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 functions/fn_update_funtions diff --git a/functions/fn_getopt b/functions/fn_getopt index 0599a94f7..3d37713e0 100644 --- a/functions/fn_getopt +++ b/functions/fn_getopt @@ -22,6 +22,8 @@ case "$getopt" in update-restart) forceupdate=1; fn_update_check;; + update-functions) + fn_update_funtions;; validate) fn_validate;; monitor) @@ -41,7 +43,7 @@ case "$getopt" in auto-install) fn_autoinstall;; *) - echo "Usage: $0 {start|stop|restart|update|force-update|validate|monitor|email-test|details|backup|console|debug|install|auto-install}" + echo "Usage: $0 {start|stop|restart|update|force-update|update-funtions|validate|monitor|email-test|details|backup|console|debug|install|auto-install}" exit 1;; esac exit @@ -57,6 +59,8 @@ case "$getopt" in fn_restart;; update) fn_update_check;; + update-functions) + fn_update_funtions;; monitor) fn_monitor;; email-test) @@ -66,7 +70,7 @@ case "$getopt" in backup) fn_backup;; *) - echo "Usage: $0 {start|stop|restart|update|monitor|email-test|details|backup}" + echo "Usage: $0 {start|stop|restart|update|update-funtions|monitor|email-test|details|backup}" exit 1;; esac exit @@ -80,6 +84,8 @@ case "$getopt" in fn_stop;; restart) fn_restart;; + update-functions) + fn_update_funtions;; monitor) fn_monitor;; email-test) @@ -97,7 +103,7 @@ case "$getopt" in map-compressor) fn_compress_ut99maps;; *) - echo "Usage: $0 {start|stop|restart|monitor|email-test|details|backup|console|debug|install|map-compressor}" + echo "Usage: $0 {start|stop|restart|update-funtions|monitor|email-test|details|backup|console|debug|install|map-compressor}" exit 1;; esac exit @@ -120,6 +126,8 @@ case "$getopt" in update-restart) forceupdate=1; fn_update_check;; + update-functions) + fn_update_funtions;; validate) fn_validate;; monitor) @@ -141,7 +149,7 @@ case "$getopt" in map-compressor) fn_compress_unreal2maps;; *) - echo "Usage: $0 {start|stop|restart|update|validate|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}" + echo "Usage: $0 {start|stop|restart|update|update-funtions|validate|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}" exit 1;; esac exit @@ -156,6 +164,8 @@ case "$getopt" in fn_stop;; restart) fn_restart;; + update-functions) + fn_update_funtions;; monitor) fn_monitor;; email-test) @@ -173,7 +183,7 @@ case "$getopt" in map-compressor) fn_compress_unreal2maps;; *) - echo "Usage: $0 {start|stop|restart|monitor|email-test|details|backup|console|debug|install|map-compressor}" + echo "Usage: $0 {start|stop|restart|update-funtions|monitor|email-test|details|backup|console|debug|install|map-compressor}" exit 1;; esac exit diff --git a/functions/fn_update_funtions b/functions/fn_update_funtions new file mode 100644 index 000000000..6a52ac024 --- /dev/null +++ b/functions/fn_update_funtions @@ -0,0 +1,9 @@ +#!/bin/bash +# LGSM fn_update_funtions function +# Author: Daniel Gibbs +# Website: http://gameservermanagers.com +# Version: 190515 + +# Description: Deletes the functions dir to allow re-downloading of functions from GitHub. + +rm -rfv "${rootdir}/functions/"* From 0c0eca9b9502a5630d98ec18198b4cb5f5b2541f Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 20:07:13 +0100 Subject: [PATCH 03/12] Added fn_update_functions --- functions/fn_functions | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/functions/fn_functions b/functions/fn_functions index fa1fb76a3..fb7a40bc0 100644 --- a/functions/fn_functions +++ b/functions/fn_functions @@ -2,7 +2,7 @@ # LGSM fn_functions function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -# Version: 160515 +# Version: 190515 # Description: Defines all functions to allow download and execution of functions using fn_runfunction. # This function is called first before any other function. Without this file other functions would not load. @@ -149,17 +149,27 @@ functionfile="${FUNCNAME}" fn_runfunction } +fn_update_check(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + +fn_update_functions(){ +functionfile="${FUNCNAME}" +fn_runfunction +} + fn_update_dl(){ functionfile="${FUNCNAME}" fn_runfunction } -fn_validate(){ +fn_update_funtions(){ functionfile="${FUNCNAME}" fn_runfunction } -fn_update_check(){ +fn_validate(){ functionfile="${FUNCNAME}" fn_runfunction } From 624af378cc3d1a0c85f41a3d1420a8a82f1a6c09 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 20:15:29 +0100 Subject: [PATCH 04/12] Added error checking. Corrected typo --- functions/fn_functions | 2 +- functions/fn_update_functions | 20 ++++++++++++++++++++ functions/fn_update_funtions | 9 --------- 3 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 functions/fn_update_functions delete mode 100644 functions/fn_update_funtions diff --git a/functions/fn_functions b/functions/fn_functions index fb7a40bc0..1e19e39fa 100644 --- a/functions/fn_functions +++ b/functions/fn_functions @@ -164,7 +164,7 @@ functionfile="${FUNCNAME}" fn_runfunction } -fn_update_funtions(){ +fn_update_functions(){ functionfile="${FUNCNAME}" fn_runfunction } diff --git a/functions/fn_update_functions b/functions/fn_update_functions new file mode 100644 index 000000000..361af6988 --- /dev/null +++ b/functions/fn_update_functions @@ -0,0 +1,20 @@ +#!/bin/bash +# LGSM fn_update_functions function +# Author: Daniel Gibbs +# Website: http://gameservermanagers.com +# Version: 190515 + +# Description: Deletes the functions dir to allow re-downloading of functions from GitHub. + +fn_printdots "Updating functions" +fn_scriptlog "Updating functions" +sleep 1 +rm -rfv "${rootdir}/functions/"* +exitcode=$? +if [ "${exitcode}" == "0" ]; then + fn_printok "Updating functions" + fn_scriptlog "Successfull! Updating functions" +else + fn_printokfail "Updating functions" + fn_scriptlog "Failure! Updating functions" +fi diff --git a/functions/fn_update_funtions b/functions/fn_update_funtions deleted file mode 100644 index 6a52ac024..000000000 --- a/functions/fn_update_funtions +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# LGSM fn_update_funtions function -# Author: Daniel Gibbs -# Website: http://gameservermanagers.com -# Version: 190515 - -# Description: Deletes the functions dir to allow re-downloading of functions from GitHub. - -rm -rfv "${rootdir}/functions/"* From a882e2f16bd70f38847fab8ce513f872ba724b91 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 20:41:59 +0100 Subject: [PATCH 05/12] Removed the chance of infinite loop Removed the chance of infinite loop if no appmanifest files found #383 --- functions/fn_update_check | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/functions/fn_update_check b/functions/fn_update_check index 0ff141e45..cf822f539 100644 --- a/functions/fn_update_check +++ b/functions/fn_update_check @@ -53,6 +53,12 @@ if [ "${appmanifestfilewc}" -ge "2" ]; then fn_update_check fi elif [ "${appmanifestfilewc}" -eq "0" ]; then + if [ "${forceupdate}" -eq "1" ]; then + fn_printfail "Still no appmanifest_${appid}.acf found: unable to update" + fn_scriptlog "Warning! Still no appmanifest_${appid}.acf found: unable to update" + exit + fi + forceupdate=1 fn_printwarn "No appmanifest_${appid}.acf found" fn_scriptlog "Warning! No appmanifest_${appid}.acf found" sleep 2 From 1c24983067f0ddb52836b02048e839f2d47f39f7 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 20:43:06 +0100 Subject: [PATCH 06/12] capital letters --- functions/fn_update_check | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/fn_update_check b/functions/fn_update_check index cf822f539..e3c6842ee 100644 --- a/functions/fn_update_check +++ b/functions/fn_update_check @@ -54,8 +54,8 @@ if [ "${appmanifestfilewc}" -ge "2" ]; then fi elif [ "${appmanifestfilewc}" -eq "0" ]; then if [ "${forceupdate}" -eq "1" ]; then - fn_printfail "Still no appmanifest_${appid}.acf found: unable to update" - fn_scriptlog "Warning! Still no appmanifest_${appid}.acf found: unable to update" + fn_printfail "Still no appmanifest_${appid}.acf found: Unable to update" + fn_scriptlog "Warning! Still no appmanifest_${appid}.acf found: Unable to update" exit fi forceupdate=1 From 795fdb38d80206fcdc4a657843a40e51a4674104 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 21:18:04 +0100 Subject: [PATCH 07/12] Fixed ts3server logs issue #378 Also optimsed this function. --- functions/fn_check_logs | 47 +++++++++-------------------------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/functions/fn_check_logs b/functions/fn_check_logs index 80ae51b2d..b029e7592 100644 --- a/functions/fn_check_logs +++ b/functions/fn_check_logs @@ -2,11 +2,11 @@ # LGSM fn_check_logs function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -# Version: 160515 +# Version: 190515 # Description: Checks that log files exist on server start # Create dir's for the script and console logs -if [ ! -f "${scriptlog}" ]; then +if [ ! -f "${scriptlogdir}" ]; then fn_printdots "Checking for log files" sleep 1 fn_printinfo "Checking for log files: Creating log files" @@ -15,61 +15,34 @@ if [ ! -f "${scriptlog}" ]; then mkdir -v "${rootdir}/log" mkdir -v "${scriptlogdir}" touch "${scriptlog}" - mkdir -v "${consolelogdir}" - touch "${consolelog}" - - # If a server is Project Zomboid create a symbolic link to the game server logs - if [ "${engine}" == "projectzomboid" ]; then - ln -nfsv "${gamelogdir}" "${rootdir}/log/server" + if [ -n "${consolelogdir}" ]; then + mkdir -v "${consolelogdir}" + touch "${consolelog}" fi - # If a server is source or goldsource create a symbolic link to the game server logs - if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then + # If a server is source or goldsource, Teamspeak 3, Starbound, Project Zomhoid create a symbolic link to the game server logs. + if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]||[ "${gamename}" == "Teamspeak 3" ]||[ "${engine}" == "starbound" ]||[ "${engine}" == "projectzomboid" ]; then if [ ! -h "${rootdir}/log/server" ]; then ln -nfsv "${gamelogdir}" "${rootdir}/log/server" - else - echo "Symbolic link ${gamelogdir} => ${rootdir}/log/server already exists!" fi fi - # If a server is unreal2 or unity3d create a dir + # If a server is unreal2 or unity3d create a dir. if [ "${engine}" == "unreal2" ]||[ "${engine}" == "unity3d" ]; then mkdir -pv "${gamelogdir}" fi - # If a server is 7 Days to Die + # If a server is 7 Days to Die. if [ "${gamename}" == "7 Days To Die" ]; then if [ ! -h "${gamelogdir}/output_log.txt" ]; then ln -nfsv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt" fi fi - # If a server is starbound create a symbolic link to the game server logs - if [ "${engine}" == "starbound" ]; then - if [ ! -h "${rootdir}/log/server" ]; then - ln -nfsv "${gamelogdir}" "${rootdir}/log/server" - else - echo "Symbolic link ${gamelogdir} => ${rootdir}/log/server already exists!" - fi - fi - - # If server uses SteamCMD create a symbolic link to the Steam logs + # If server uses SteamCMD create a symbolic link to the Steam logs. if [ -d "${rootdir}/Steam/logs" ]; then if [ ! -h "${rootdir}/log/steamcmd" ]; then ln -nfsv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd" - else - echo "Symbolic link ${rootdir}/Steam/logs => ${rootdir}/log/steamcmd already exists!" - fi - fi - - # If server is Teamspeak 3 - if [ "${engine}" == "Teamspeak 3" ]; then - if [ ! -d "${scriptlogdir}" ];then - mkdir "${rootdir}/log" - mkdir "${scriptlogdir}" - fi - if [ ! -h "${rootdir}/log/server" ]; then - ln -sv "${gamelogdir}" "${rootdir}/log/server" fi fi sleep 1 From 04313dfa737c9a4db029339a2467ae06e8365d2e Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 21:19:07 +0100 Subject: [PATCH 08/12] Fixed typo --- functions/fn_getopt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/fn_getopt b/functions/fn_getopt index 3d37713e0..b745441c0 100644 --- a/functions/fn_getopt +++ b/functions/fn_getopt @@ -23,7 +23,7 @@ case "$getopt" in forceupdate=1; fn_update_check;; update-functions) - fn_update_funtions;; + fn_update_functions;; validate) fn_validate;; monitor) @@ -60,7 +60,7 @@ case "$getopt" in update) fn_update_check;; update-functions) - fn_update_funtions;; + fn_update_functions;; monitor) fn_monitor;; email-test) @@ -85,7 +85,7 @@ case "$getopt" in restart) fn_restart;; update-functions) - fn_update_funtions;; + fn_update_functions;; monitor) fn_monitor;; email-test) @@ -127,7 +127,7 @@ case "$getopt" in forceupdate=1; fn_update_check;; update-functions) - fn_update_funtions;; + fn_update_functions;; validate) fn_validate;; monitor) @@ -165,7 +165,7 @@ case "$getopt" in restart) fn_restart;; update-functions) - fn_update_funtions;; + fn_update_functions;; monitor) fn_monitor;; email-test) From 8dfd057c1d6cc8f7014526b035cb505da2401a14 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 21:20:13 +0100 Subject: [PATCH 09/12] Added new line --- functions/fn_update_functions | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/fn_update_functions b/functions/fn_update_functions index 361af6988..41695c052 100644 --- a/functions/fn_update_functions +++ b/functions/fn_update_functions @@ -18,3 +18,4 @@ else fn_printokfail "Updating functions" fn_scriptlog "Failure! Updating functions" fi +echo -ne "\n" From 4ecf5089a84920b4f65b8ca86fc8ff73f9b8ada2 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 21:21:11 +0100 Subject: [PATCH 10/12] Added another newline --- functions/fn_update_functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/fn_update_functions b/functions/fn_update_functions index 41695c052..be34069df 100644 --- a/functions/fn_update_functions +++ b/functions/fn_update_functions @@ -6,7 +6,7 @@ # Description: Deletes the functions dir to allow re-downloading of functions from GitHub. -fn_printdots "Updating functions" +fn_printdotsnl "Updating functions" fn_scriptlog "Updating functions" sleep 1 rm -rfv "${rootdir}/functions/"* From 82ca9c18ffd11eded8c08af9ef4f9b1bff013a0f Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 21:23:45 +0100 Subject: [PATCH 11/12] New lines --- functions/fn_update_functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/fn_update_functions b/functions/fn_update_functions index be34069df..70841b597 100644 --- a/functions/fn_update_functions +++ b/functions/fn_update_functions @@ -9,6 +9,7 @@ fn_printdotsnl "Updating functions" fn_scriptlog "Updating functions" sleep 1 +echo -ne "\n" rm -rfv "${rootdir}/functions/"* exitcode=$? if [ "${exitcode}" == "0" ]; then @@ -18,4 +19,4 @@ else fn_printokfail "Updating functions" fn_scriptlog "Failure! Updating functions" fi -echo -ne "\n" +echo -ne "\n" \ No newline at end of file From a635e01e91a7d2456c1b6ed6c8f274a6f1290552 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 21:26:09 +0100 Subject: [PATCH 12/12] replaced fn_printdotsnl with fn_printdots --- functions/fn_update_functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/fn_update_functions b/functions/fn_update_functions index 70841b597..731085485 100644 --- a/functions/fn_update_functions +++ b/functions/fn_update_functions @@ -6,7 +6,7 @@ # Description: Deletes the functions dir to allow re-downloading of functions from GitHub. -fn_printdotsnl "Updating functions" +fn_printdots "Updating functions" fn_scriptlog "Updating functions" sleep 1 echo -ne "\n"