From 515c8b7213b3ad8038eea82a5437cd69a6436a09 Mon Sep 17 00:00:00 2001 From: Scott Smith Date: Wed, 1 Jun 2016 23:03:54 +0100 Subject: [PATCH] Checks if "log" folder already exists Checks if the log folder already exists and just displays a warning message, otherwise it creates the folders --- functions/fn_install_logs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/functions/fn_install_logs b/functions/fn_install_logs index ee1a47287..bdf41cf09 100644 --- a/functions/fn_install_logs +++ b/functions/fn_install_logs @@ -11,12 +11,16 @@ if [ "${checklogs}" != "1" ]; then fi sleep 1 # Create dir's for the script and console logs -mkdir -v "${rootdir}/log" -mkdir -v "${scriptlogdir}" -touch "${scriptlog}" -if [ -n "${consolelogdir}" ]; then - mkdir -v "${consolelogdir}" - touch "${consolelog}" +if [ -d "${rootdir}/log" ]; then + fn_print_warning_nl "Log folders already exist!" +else + mkdir -v "${rootdir}/log" + mkdir -v "${scriptlogdir}" + touch "${scriptlog}" + if [ -n "${consolelogdir}" ]; then + mkdir -v "${consolelogdir}" + touch "${consolelog}" + fi fi # If a server is source or goldsource, Teamspeak 3, Starbound, Project Zomhoid create a symbolic link to the game server logs. @@ -44,4 +48,4 @@ if [ -d "${rootdir}/Steam/logs" ]; then ln -nfsv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd" fi fi -sleep 1 \ No newline at end of file +sleep 1