Browse Source

Added comments

pull/688/head
lrob 9 years ago
parent
commit
1bb6844da4
  1. 12
      functions/logs.sh

12
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" fn_scriptlog "Removing logs older than ${logdays} days"
sleep 1 sleep 1
echo -en "\n" 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 if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" find "${gamelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}"
fi 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 "${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 if [ -n "${consolelog}" ]; then
find "${consolelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}" find "${consolelogdir}"/ -type f -mtime +${logdays}|tee >> "${scriptlog}"
fi fi
# Retrocompatibility, for logs directly in /log folder
# Count how many script logfiles will be removed
if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
gamecount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) gamecount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l)
fi fi
# Count how many script logfiles will be removed
scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l)
echo "${consolelog}" echo "${consolelog}"
# Count how many console logfiles will be removed
if [ -n "${consolelog}" ]; then if [ -n "${consolelog}" ]; then
consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l) consolecount=$(find "${consolelogdir}"/ -type f -mtime +${logdays}|wc -l)
else else
consolecount=0 consolecount=0
fi fi
# Count total amount of files to remove
count=$((${scriptcount} + ${consolecount})) count=$((${scriptcount} + ${consolecount}))
if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
count=$((${scriptcount} + ${consolecount} + ${gamecount})) count=$((${scriptcount} + ${consolecount} + ${gamecount}))
@ -64,7 +72,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +${logdays}|wc -l) -ne "0" ]; then
count=$((${scriptcount} + ${consolecount})) count=$((${scriptcount} + ${consolecount}))
fi fi
# Removing logfiles
if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
find "${gamelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \; find "${gamelogdir}"/ -mtime +${logdays} -type f -exec rm -f {} \;
fi fi

Loading…
Cancel
Save