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 diff --git a/functions/fn_functions b/functions/fn_functions index fa1fb76a3..1e19e39fa 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_functions(){ functionfile="${FUNCNAME}" fn_runfunction } -fn_update_check(){ +fn_validate(){ functionfile="${FUNCNAME}" fn_runfunction } diff --git a/functions/fn_getopt b/functions/fn_getopt index bdf508397..5c6d0afba 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_functions;; 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_functions;; monitor) fn_monitor;; email-test) @@ -70,7 +74,7 @@ case "$getopt" in auto-install) fn_autoinstall;; *) - echo "Usage: $0 {start|stop|restart|update|monitor|email-test|details|backup|install|auto-install}" + echo "Usage: $0 {start|stop|restart|update|update-funtions|monitor|email-test|details|backup|install|auto-install}" exit 1;; esac exit @@ -84,6 +88,8 @@ case "$getopt" in fn_stop;; restart) fn_restart;; + update-functions) + fn_update_functions;; monitor) fn_monitor;; email-test) @@ -101,7 +107,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 @@ -118,6 +124,14 @@ case "$getopt" in fn_restart;; update) fn_update_check;; + force-update) + forceupdate=1; + fn_update_check;; + update-restart) + forceupdate=1; + fn_update_check;; + update-functions) + fn_update_functions;; validate) fn_validate;; monitor) @@ -139,7 +153,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 @@ -154,6 +168,8 @@ case "$getopt" in fn_stop;; restart) fn_restart;; + update-functions) + fn_update_functions;; monitor) fn_monitor;; email-test) @@ -171,7 +187,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_check b/functions/fn_update_check index 0ff141e45..e3c6842ee 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 diff --git a/functions/fn_update_functions b/functions/fn_update_functions new file mode 100644 index 000000000..731085485 --- /dev/null +++ b/functions/fn_update_functions @@ -0,0 +1,22 @@ +#!/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 +echo -ne "\n" +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 +echo -ne "\n" \ No newline at end of file