gameservergame-servergame-servershacktoberfestdedicated-game-serversgamelinuxgsmserverbashgaminglinuxmultiplayer-game-servershell
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.6 KiB
47 lines
1.6 KiB
#!/bin/bash
|
|
# LGSM fn_logmanager function
|
|
# Author: Daniel Gibbs
|
|
# Website: http://danielgibbs.co.uk
|
|
# Version: 011214
|
|
|
|
if [ ! -e "${consolelog}" ]; then
|
|
touch "${consolelog}"
|
|
fi
|
|
# log manager will active if finds logs older than ${logdays}
|
|
if [ $(find "${scriptlogdir}"/* -mtime +${logdays}|wc -l) -ne "0" ]; then
|
|
fn_printdots "Starting log cleaner"
|
|
sleep 1
|
|
fn_printok "Starting log cleaner"
|
|
fn_scriptlog "Starting log cleaner"
|
|
sleep 1
|
|
echo -en "\n"
|
|
fn_printinfo "Removing logs older than ${logdays} days"
|
|
fn_scriptlog "Removing logs older than ${logdays} days"
|
|
sleep 1
|
|
echo -en "\n"
|
|
if [ "${engine}" == "unreal2" ]; then
|
|
find "${gamelogdir}"/* -mtime +${logdays}|tee >> "${scriptlog}"
|
|
fi
|
|
find "${scriptlogdir}"/* -mtime +${logdays}|tee >> "${scriptlog}"
|
|
find "${consolelogdir}"/* -mtime +${logdays}|tee >> "${scriptlog}"
|
|
if [ "${engine}" == "unreal2" ]; then
|
|
gamecount=$(find "${scriptlogdir}"/* -mtime +${logdays}|wc -l)
|
|
fi
|
|
scriptcount=$(find "${scriptlogdir}"/* -mtime +${logdays}|wc -l)
|
|
consolecount=$(find "${consolelogdir}"/* -mtime +${logdays}|wc -l)
|
|
count=$((${scriptcount} + ${consolecount}))
|
|
if [ "${engine}" == "unreal2" ]; then
|
|
count=$((${scriptcount} + ${consolecount} + ${gamecount}))
|
|
else
|
|
count=$((${scriptcount} + ${consolecount}))
|
|
fi
|
|
if [ "${engine}" == "unreal2" ]; then
|
|
find "${gamelogdir}"/* -mtime +${logdays} -exec rm {} \;
|
|
fi
|
|
find "${scriptlogdir}"/* -mtime +${logdays} -exec rm {} \;
|
|
find "${consolelogdir}"/* -mtime +${logdays} -exec rm {} \;
|
|
fn_printok "Log cleaner removed ${count} log files"
|
|
fn_scriptlog "Log cleaner removed ${count} log files"
|
|
sleep 1
|
|
echo -en "\n"
|
|
fi
|