From 919b4b3b1dd27f560eb842dee45e6b8bfc5d5f5f Mon Sep 17 00:00:00 2001 From: Tommaso De Marchi Date: Wed, 6 Nov 2019 09:16:40 +0100 Subject: [PATCH] fixes #227 --- files/internals/tlog | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/files/internals/tlog b/files/internals/tlog index 4970376..d89ae1d 100755 --- a/files/internals/tlog +++ b/files/internals/tlog @@ -4,6 +4,7 @@ ### # Copyright (C) 2002-2008, R-fx Networks # Copyright (C) 2008, Ryan MacDonald +# Copyright (C) 2019, Tommaso De Marchi # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -52,37 +53,37 @@ TSIZE=`cat $BASERUN/$TLOG` >> /dev/null 2>&1 getsize() { if [ ! -f "$BASERUN/$TLOG" ]; then - SIZE=`stat -c %s $FILE` + SIZE=`wc -l $FILE | cut -d' ' -f1` echo $SIZE > $BASERUN/$TLOG - NEWSIZE=`stat -c %s $FILE` + NEWSIZE=`wc -l $FILE | cut -d' ' -f1` elif [ -f "$BASERUN/$TLOG" ] && [ "$TSIZE" == "0" ]; then - SIZE=`stat -c %s $FILE` + SIZE=`wc -l $FILE | cut -d' ' -f1` echo $SIZE > $BASERUN/$TLOG - NEWSIZE=`stat -c %s $FILE` + NEWSIZE=`wc -l $FILE | cut -d' ' -f1` SIZE=0 else SIZE=`cat $BASERUN/$TLOG` - NEWSIZE=`stat -c %s $FILE` + NEWSIZE=`wc -l $FILE | cut -d' ' -f1` fi } getsize if [ ! "$NEWSIZE" -lt "$SIZE" ] && [ "$NEWSIZE" -ne "$SIZE" ]; then - tail -c `expr $NEWSIZE - $SIZE` $FILE + tail -`expr $NEWSIZE - $SIZE` $FILE echo $NEWSIZE > $BASERUN/$TLOG -elif [ "$NEWSIZE" -lt "$SIZE" ]; then +elif [ "$NEWSIZE" -lt "$SIZE" ]; then if [ -f "$FILE.1" ]; then - RTSIZE=`stat -c %s $FILE.1` - tail -c `expr $RTSIZE - $SIZE` $FILE.1 + RTSIZE=`wc -l $FILE.1 | cut -d' ' -f1` + tail `expr $RTSIZE - $SIZE` $FILE.1 elif [ -f "$FILE.1.gz" ]; then gunzip $FILE.1.gz - RTSIZE=`stat -c %s $FILE.1` - tail -c `expr $RTSIZE - $SIZE` $FILE.1 + RTSIZE=`wc -l $FILE.1 | cut -d' ' -f1` + tail `expr $RTSIZE - $SIZE` $FILE.1 gzip $FILE.1 fi SIZE=0 echo "$NEWSIZE" > $BASERUN/$TLOG - tail -c `expr $NEWSIZE - $SIZE` $FILE + tail `expr $NEWSIZE - $SIZE` $FILE echo $NEWSIZE > $BASERUN/$TLOG fi