1. FILE1=/var/log/zimbra.log
2. FOLDER=/tmp/test
2. NUMBER=/tmp/test/number.txt file
To output
TEMP_LOG=$FOLDER/tmp_zimbra.log
Function f_check_folder to check folder existing yes or no.
f_check_folder () {
if [[ -d $FOLDER ]]; then
if [[ ! -s $NUMBER ]]; then
touch $NUMBER
echo 0 > $NUMBER
fi
else
mkdir -p $FOLDER
touch $NUMBER
echo 0 > $NUMBER
fi
}
Function f_get_log read /var/log/zimbra.log file
f_get_log () {
NUM=`cat $NUMBER`
SUM=`expr "$NUM" + 1`
tail -n +"$SUM" $FILE1 > $TEMP_LOG
echo `wc -l < $FILE1` > $NUMBER
}
Thanks for reading Log file zimbra script My blog Effortless Zimbra Mail Management: Unleashing the Power of Linux Commands, How-To, and Bash Scripts I hope this is useful.
1 Comments :
Hi, what do this script?
Relay