#!/bin/sh

file1="/tmp/log/logfile01.p7d"
file2="/tmp/log/logfile02.p7d"

while true; do 
  # 获取文件大小
  size1=$(stat -c%s "$file1")
  size2=$(stat -c%s "$file2")

  # 输出较小文件的文件名并显示内容
  if [ $size1 -lt $size2 ]; then
      echo "Smaller file: $file1"
      p7cat "$file1" | grep -E 'front_cliff' | tail
  else
      echo "Smaller file: $file2"
      p7cat "$file1" | grep -E 'front_cliff' | tail
  fi
  echo "==============================================="
  sleep 0.5
done

