From 61b5aacc74b50fef4321e3fd32515f983503bd1f Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 11:37:03 +0100 Subject: [PATCH 01/11] Added variables for additional logs --- functions/logs.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/functions/logs.sh b/functions/logs.sh index ecca143c0..317af4255 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -2,17 +2,31 @@ # LGSM logs.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="271215" +lgsm_version="100215" # Description: Acts as a log rotater, removing old logs. local modulename="Log Manager" +# Check if logfile variable and file exist, create logfile if it doesn't exist if [ -n "${consolelog}" ]; then if [ ! -e "${consolelog}" ]; then touch "${consolelog}" fi fi + +# Set source log directory +if [ -z "${systemdir}" && "${engine}" == "source" ]; then + srcdslogdir="${systemdir}/logs" + # Set addons directories + sourcemodlogdir="${systemdir}/addons/sourcemod/logs" + # Set gmod addons directories + if [ "${gamename}" == "Garry's Mod" ]; then + ulxlogdir="${systemdir}/data/ulx_logs" + darkrplogdir="${systemdir}/data/darkrp_logs" + fi +fi + # log manager will active if finds logs older than ${logdays} if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then fn_printdots "Starting" From 1bb6844da4fbea769abb6f8afa66c12af4fc37fc Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 12:55:07 +0100 Subject: [PATCH 02/11] Added comments --- functions/logs.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index 317af4255..68b66989b 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -39,24 +39,32 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then fn_scriptlog "Removing logs older than ${logdays} days" sleep 1 echo -en "\n" + # Retrocompatibility, for logs directly in /log folder + # Find game logfiles older than ${logdays} and write that list to the current script log if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" fi + # Find script logfiles older than ${logdays} and write that list to the current script log find "${scriptlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" + # Find console logfiles older than ${logdays} and write that list to the current script log if [ -n "${consolelog}" ]; then find "${consolelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" fi + # Retrocompatibility, for logs directly in /log folder + # Count how many script logfiles will be removed if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then gamecount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) fi + # Count how many script logfiles will be removed scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) echo "${consolelog}" + # Count how many console logfiles will be removed if [ -n "${consolelog}" ]; then consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l) else consolecount=0 fi - + # Count total amount of files to remove count=$((${scriptcount} + ${consolecount})) if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then count=$((${scriptcount} + ${consolecount} + ${gamecount})) @@ -64,7 +72,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then count=$((${scriptcount} + ${consolecount})) fi - + # Removing logfiles if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then find "${gamelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; fi From f25bc42f6373f8b66711b97cafc8a4cdaacf5798 Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 13:00:14 +0100 Subject: [PATCH 03/11] Fix gamecount targetting wrong folder Gamecount should target gamelogdir, not scriptlogdir, as it seems to be for retrocompatibility only, and according to this (line 44) : if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" fi --- functions/logs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/logs.sh b/functions/logs.sh index 68b66989b..885fe7722 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -53,7 +53,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then # Retrocompatibility, for logs directly in /log folder # Count how many script logfiles will be removed if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then - gamecount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) + gamecount=$(find "${gamelogdir}"/ -type f -mtime +${logdays}|wc -l) fi # Count how many script logfiles will be removed scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) From eb67a375ad9100162643dc9b9a175548957be7df Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 13:11:51 +0100 Subject: [PATCH 04/11] Simplifying counting Why make it simple when you can make it harder ! > Removing conditional functions for additions, by setting all variables to 0 before starting counting. > Removing "else, set to 0", as 0 is now the default state --- functions/logs.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index 885fe7722..75ad64347 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -50,6 +50,9 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then if [ -n "${consolelog}" ]; then find "${consolelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" fi + # Counting + # Setting up variables + scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" # Retrocompatibility, for logs directly in /log folder # Count how many script logfiles will be removed if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then @@ -58,19 +61,12 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then # Count how many script logfiles will be removed scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) echo "${consolelog}" - # Count how many console logfiles will be removed + # Count how many console logfiles will be removed, if those logs exist if [ -n "${consolelog}" ]; then consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l) - else - consolecount=0 fi # Count total amount of files to remove - count=$((${scriptcount} + ${consolecount})) - if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then - count=$((${scriptcount} + ${consolecount} + ${gamecount})) - else - count=$((${scriptcount} + ${consolecount})) - fi + count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount})) # Removing logfiles if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then From f91b736ec7d4970aef6a8e83b0831b30aa0c30d0 Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 14:10:10 +0100 Subject: [PATCH 05/11] Merging all in one, adding new logs support Merging logging, counting, and removing logfiles in one place, to avoid some redundant if statements Also, understanding the code and supporting new logs should be easier. Adding srcds / sm / ulx / darkrp logs support --- functions/logs.sh | 74 ++++++++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index 75ad64347..9833b7db0 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -15,7 +15,7 @@ if [ -n "${consolelog}" ]; then fi fi -# Set source log directory +# Set source logs directories if [ -z "${systemdir}" && "${engine}" == "source" ]; then srcdslogdir="${systemdir}/logs" # Set addons directories @@ -27,7 +27,10 @@ if [ -z "${systemdir}" && "${engine}" == "source" ]; then fi fi -# log manager will active if finds logs older than ${logdays} +# Setting up counting variables +scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" + +# Log manager will start the cleanup if it finds logs older than ${logdays} if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then fn_printdots "Starting" sleep 1 @@ -39,43 +42,54 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then fn_scriptlog "Removing logs older than ${logdays} days" sleep 1 echo -en "\n" - # Retrocompatibility, for logs directly in /log folder - # Find game logfiles older than ${logdays} and write that list to the current script log - if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then - find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" - fi - # Find script logfiles older than ${logdays} and write that list to the current script log + # Logging logfiles to be removed according to ${logdays}, counting and removing them + # Script logfiles find "${scriptlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" - # Find console logfiles older than ${logdays} and write that list to the current script log - if [ -n "${consolelog}" ]; then - find "${consolelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" - fi - # Counting - # Setting up variables - scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" + scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) + find "${scriptlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; # Retrocompatibility, for logs directly in /log folder - # Count how many script logfiles will be removed if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then + find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" gamecount=$(find "${gamelogdir}"/ -type f -mtime +${logdays}|wc -l) - fi - # Count how many script logfiles will be removed - scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) - echo "${consolelog}" - # Count how many console logfiles will be removed, if those logs exist - if [ -n "${consolelog}" ]; then - consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l) - fi - # Count total amount of files to remove - count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount})) - - # Removing logfiles - if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then find "${gamelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; fi - find "${scriptlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + # Console logfiles if [ -n "${consolelog}" ]; then + find "${consolelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" + consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l) find "${consolelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; fi + # SRCDS logfiles + if [ "${engine}" == "source" ]; then + if [ -d "${srcdslogdir}" ]; then + find "${srcdslogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" + srcdscount=$(find "${srcdslogdir}"/ -type f -mtime +${logdays}|wc -l) + find "${srcdslogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + fi + # SourceMod logfiles + if [ -d "${sourcemodlogdir}" ]; then + find "${sourcemodlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" + smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +${logdays}|wc -l) + find "${sourcemodlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + fi + # ULX logfiles + if [ "${gamename}" == "Garry's Mod" ] + if [ -d "${ulxlogdir}" ]; then + find "${ulxlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" + ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +${logdays}|wc -l) + find "${ulxlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + fi + if [ -d "${darkrplogdir}" ]; then + find "${darkrplogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" + darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +${logdays}|wc -l) + find "${darkrplogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + fi + fi + fi + + # Count total amount of files removed + count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount})) + # Job done fn_printok "Removed ${count} log files" fn_scriptlog "Removed ${count} log files" sleep 1 From 65d58f6d7d1ed6c965c14989a99deb853f0a301f Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 14:48:43 +0100 Subject: [PATCH 06/11] correcting syntax --- functions/logs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index 9833b7db0..d295fd72f 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -16,7 +16,7 @@ if [ -n "${consolelog}" ]; then fi # Set source logs directories -if [ -z "${systemdir}" && "${engine}" == "source" ]; then +if [ -z "${systemdir}" ]&&[ "${engine}" == "source" ]; then srcdslogdir="${systemdir}/logs" # Set addons directories sourcemodlogdir="${systemdir}/addons/sourcemod/logs" @@ -73,7 +73,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then find "${sourcemodlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; fi # ULX logfiles - if [ "${gamename}" == "Garry's Mod" ] + if [ "${gamename}" == "Garry's Mod" ]; then if [ -d "${ulxlogdir}" ]; then find "${ulxlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +${logdays}|wc -l) From 37f4acbf90f382e39bd3971c3bf1b13796055e5a Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 15:06:06 +0100 Subject: [PATCH 07/11] Removing double SRCDS, improving comments and removing useless check for creating folders variables --- functions/logs.sh | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index d295fd72f..680f3ecc0 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -15,17 +15,10 @@ if [ -n "${consolelog}" ]; then fi fi -# Set source logs directories -if [ -z "${systemdir}" ]&&[ "${engine}" == "source" ]; then - srcdslogdir="${systemdir}/logs" - # Set addons directories - sourcemodlogdir="${systemdir}/addons/sourcemod/logs" - # Set gmod addons directories - if [ "${gamename}" == "Garry's Mod" ]; then - ulxlogdir="${systemdir}/data/ulx_logs" - darkrplogdir="${systemdir}/data/darkrp_logs" - fi -fi +# Set addon logs directories +sourcemodlogdir="${systemdir}/addons/sourcemod/logs" +ulxlogdir="${systemdir}/data/ulx_logs" +darkrplogdir="${systemdir}/data/darkrp_logs" # Setting up counting variables scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" @@ -47,7 +40,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then find "${scriptlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) find "${scriptlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; - # Retrocompatibility, for logs directly in /log folder + # SRCDS and unreal logfiles if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" gamecount=$(find "${gamelogdir}"/ -type f -mtime +${logdays}|wc -l) @@ -59,26 +52,23 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l) find "${consolelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; fi - # SRCDS logfiles + # Source addons logfiles if [ "${engine}" == "source" ]; then - if [ -d "${srcdslogdir}" ]; then - find "${srcdslogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" - srcdscount=$(find "${srcdslogdir}"/ -type f -mtime +${logdays}|wc -l) - find "${srcdslogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; - fi # SourceMod logfiles if [ -d "${sourcemodlogdir}" ]; then find "${sourcemodlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +${logdays}|wc -l) find "${sourcemodlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; fi - # ULX logfiles + # Garry's Mod logfiles if [ "${gamename}" == "Garry's Mod" ]; then + # ULX logfiles if [ -d "${ulxlogdir}" ]; then find "${ulxlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +${logdays}|wc -l) find "${ulxlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; fi + # DarkRP logfiles if [ -d "${darkrplogdir}" ]; then find "${darkrplogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +${logdays}|wc -l) @@ -86,7 +76,6 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then fi fi fi - # Count total amount of files removed count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount})) # Job done From bb552e1d0747576dbb3801699c087145e997a049 Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 15:14:49 +0100 Subject: [PATCH 08/11] Moving variable initialization inside if function --- functions/logs.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index 680f3ecc0..8e04d5a15 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -15,17 +15,15 @@ if [ -n "${consolelog}" ]; then fi fi -# Set addon logs directories -sourcemodlogdir="${systemdir}/addons/sourcemod/logs" -ulxlogdir="${systemdir}/data/ulx_logs" -darkrplogdir="${systemdir}/data/darkrp_logs" - -# Setting up counting variables -scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" - # Log manager will start the cleanup if it finds logs older than ${logdays} if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then fn_printdots "Starting" + # Set addon logs directories + sourcemodlogdir="${systemdir}/addons/sourcemod/logs" + ulxlogdir="${systemdir}/data/ulx_logs" + darkrplogdir="${systemdir}/data/darkrp_logs" + # Setting up counting variables + scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" sleep 1 fn_printok "Starting" fn_scriptlog "Starting" From 2bde7897a7222add099f9294033c63cd9964de0a Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 15:54:06 +0100 Subject: [PATCH 09/11] Adding legacy server log dir support --- functions/logs.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/functions/logs.sh b/functions/logs.sh index 8e04d5a15..8b8952a0d 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -22,8 +22,9 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then sourcemodlogdir="${systemdir}/addons/sourcemod/logs" ulxlogdir="${systemdir}/data/ulx_logs" darkrplogdir="${systemdir}/data/darkrp_logs" + legacyserverlogdir="${rootdir}/log/server" # Setting up counting variables - scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" + scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" ; legacycount="0" sleep 1 fn_printok "Starting" fn_scriptlog "Starting" @@ -74,8 +75,19 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then fi fi fi + # Legacy support + if [ -d "${legacyserverlogdir}" ]; then + find "${legacyserverlogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" + legacycount=$(find "${legacyserverlogdir}"/ -type f -mtime +${logdays}|wc -l) + find "${legacyserverlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; + # Remove folder if empty + if [ ! "$(ls -A "${legacyserverlogdir}"" ]; then + rm -rf "${legacyserverlogdir}" + fi + fi + # Count total amount of files removed - count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount})) + count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount} + ${legacycount})) # Job done fn_printok "Removed ${count} log files" fn_scriptlog "Removed ${count} log files" From 9a2bbfd572146718bced4b652878e2f424821c74 Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 16:23:44 +0100 Subject: [PATCH 10/11] Closing parenthesis, works better. --- functions/logs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/logs.sh b/functions/logs.sh index 8b8952a0d..86b366848 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -81,7 +81,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then legacycount=$(find "${legacyserverlogdir}"/ -type f -mtime +${logdays}|wc -l) find "${legacyserverlogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; # Remove folder if empty - if [ ! "$(ls -A "${legacyserverlogdir}"" ]; then + if [ ! "$(ls -A "${legacyserverlogdir}")" ]; then rm -rf "${legacyserverlogdir}" fi fi From fce7a6a957deb9a66237e838cc824d180a16f03d Mon Sep 17 00:00:00 2001 From: lrob Date: Wed, 10 Feb 2016 16:28:24 +0100 Subject: [PATCH 11/11] Added myself as a contributor :) --- functions/logs.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/logs.sh b/functions/logs.sh index 86b366848..83c80437d 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -1,6 +1,7 @@ #!/bin/bash # LGSM logs.sh function # Author: Daniel Gibbs +# Contributor: UltimateByte # Website: http://gameservermanagers.com lgsm_version="100215"