|
|
@@ -28,7 +28,7 @@ if [ "${status}" != "0" ] && [ "${function_selfname}" == "command_start.sh" ] &&
|
|
|
fi
|
|
|
|
|
|
# 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
|
|
|
+if [ $(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; then
|
|
|
fn_print_dots "Starting"
|
|
|
# Set common logs directories
|
|
|
commonlogs="${systemdir}/logs"
|
|
|
@@ -46,29 +46,29 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
|
|
|
fn_script_log_info "Removing logs older than "${logdays}" days"
|
|
|
# Logging logfiles to be removed according to "${logdays}", counting and removing them
|
|
|
# Script logfiles
|
|
|
- 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 {} \;
|
|
|
+ find "${lgsmlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
|
|
|
+ scriptcount=$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
|
|
|
+ find "${lgsmlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
|
|
|
# SRCDS and unreal logfiles
|
|
|
if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
|
|
|
- find "${gamelogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
|
|
|
+ find "${gamelogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
|
|
|
gamecount=$(find "${gamelogdir}"/ -type f -mtime +"${logdays}"|wc -l)
|
|
|
find "${gamelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
|
|
|
fi
|
|
|
# Console logfiles
|
|
|
if [ -n "${consolelog}" ]; then
|
|
|
- find "${consolelogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
|
|
|
+ find "${consolelogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
|
|
|
consolecount=$(find "${consolelogdir}"/ -type f -mtime +"${logdays}"|wc -l)
|
|
|
find "${consolelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
|
|
|
fi
|
|
|
# Common logfiles
|
|
|
- if [ -d ${commonlogs} ]; then
|
|
|
- find "${commonlogs}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
|
|
|
+ if [ -d "${commonlogs}" ]; then
|
|
|
+ find "${commonlogs}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
|
|
|
smcount=$(find "${commonlogs}"/ -type f -mtime +"${logdays}"|wc -l)
|
|
|
find "${commonlogs}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
|
|
|
fi
|
|
|
if [ -d ${commonsourcelogs} ]; then
|
|
|
- find "${commonsourcelogs}"/* -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
|
|
|
+ find "${commonsourcelogs}"/* -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
|
|
|
smcount=$(find "${commonsourcelogs}"/* -type f -mtime +"${logdays}"|wc -l)
|
|
|
find "${commonsourcelogs}"/* -mtime +"${logdays}" -type f -exec rm -f {} \;
|
|
|
fi
|
|
|
@@ -76,7 +76,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
|
|
|
if [ "${engine}" == "source" ]; then
|
|
|
# SourceMod logfiles
|
|
|
if [ -d "${sourcemodlogdir}" ]; then
|
|
|
- find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
|
|
|
+ find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
|
|
|
smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
|
|
|
find "${sourcemodlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
|
|
|
fi
|
|
|
@@ -84,28 +84,22 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
|
|
|
if [ "${gamename}" == "Garry's Mod" ]; then
|
|
|
# ULX logfiles
|
|
|
if [ -d "${ulxlogdir}" ]; then
|
|
|
- find "${ulxlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
|
|
|
+ find "${ulxlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
|
|
|
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}"
|
|
|
+ find "${darkrplogdir}"/ -type f -mtime +"${logdays}"| tee >> "${lgsmlog}"
|
|
|
darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +"${logdays}"|wc -l)
|
|
|
find "${darkrplogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
|
|
|
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 {} \;
|
|
|
- fi
|
|
|
|
|
|
# Count total amount of files removed
|
|
|
- count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount} + ${legacycount}))
|
|
|
+ countlogs=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount}))
|
|
|
# Job done
|
|
|
- fn_print_ok_nl "Removed ${count} log files"
|
|
|
- fn_script_log "Removed ${count} log files"
|
|
|
+ fn_print_ok_nl "Removed ${countlogs} log files"
|
|
|
+ fn_script_log "Removed ${countlogs} log files"
|
|
|
fi
|