Huu Phan | Blog Linux operating system | Linux operating system -Blog Huu Phan | Powered by Blogger.

Explore the world of seamless email management with Zimbra Mail on Linux! Our blog delves into a step-by-step guide on harnessing the potential of Linux commands, providing easy-to-follow how-tos, and unlocking the magic of Bash scripting. Simplify your email administration journey and enhance your skills with our insightful tips and tricks.

Log file zimbra script

The function read /var/log/zimbra.log use bash script.

To input
1. FILE1=/var/log/zimbra.log
2. FOLDER=/tmp/test
2. NUMBER=/tmp/test/number.txt file

To output

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
                mkdir -p $FOLDER
                touch $NUMBER
                echo 0 > $NUMBER

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

Log file zimbra script

post new :

Huu Phan | Blog Linux operating system | Huu Phan ~ Zimbra Mail Server,linux,bash script,centos,linux command |


This Blog is protected by