From 795fdb38d80206fcdc4a657843a40e51a4674104 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 19 May 2015 21:18:04 +0100 Subject: [PATCH] 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