pmonitork.sh 384 B

1234567891011121314151617
  1. #!/bin/sh
  2. # log a file tail
  3. #Xdialog --title "Monitoring tail of $1" --smooth --fixed-font --no-cancel --ok-label "Exit" --tailbox $1 18 95
  4. LINES1=0
  5. LINES2=0
  6. while [ 1 ];do
  7. LINES2=`wc -l /var/log/messages | tr -s " " | cut -f 2 -d " "`
  8. if [ $LINES2 -gt $LINES1 ];then
  9. LINESDIFF=`expr $LINES2 - $LINES1`
  10. tail -n $LINESDIFF /var/log/messages
  11. LINES1=$LINES2
  12. fi
  13. sleep 1
  14. done