From 3ce77a5b53f14a6f2d04a54a81da7edb5a473f6e Mon Sep 17 00:00:00 2001 From: Scott Smith Date: Wed, 1 Jun 2016 23:57:58 +0100 Subject: [PATCH] Checks if "log" folder already exists If the folder does exist, just displays a warning to the user. Otherwise, it creates the folders. This just removes the standard bash error message from the user --- lgsm/functions/install_logs.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lgsm/functions/install_logs.sh b/lgsm/functions/install_logs.sh index 5ce29635e..d6b680eeb 100644 --- a/lgsm/functions/install_logs.sh +++ b/lgsm/functions/install_logs.sh @@ -13,12 +13,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. @@ -40,4 +44,4 @@ if [ -d "${rootdir}/Steam/logs" ]; then fi fi sleep 1 -fn_scriptlog "logs installed" \ No newline at end of file +fn_scriptlog "logs installed"