|
|
@ -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 |
|
|
|