The new feature is demonstrated by a wrapper script around tail which
gives me the ability to use tail to drive arbitrary alerts like this
(only the core concept lines are shown):

 

# put it into the background

tail -n 0 -f error_file > working_file & 

 

#wait for some lines to arrive

while ! test -s working_file

do

 

    echo nothing yet...  Going to sleep for:timeout:$timeout: >&2

    sleep $timeout

 

done

 

#got some lines so cat them

cat working_file

 

This allows me to watch a file for maybe 10 second intervals, and grab
all lines that arrived during that time interval.  If nothing arrived,
then it keeps on waiting.  This effectively allows me to drive shell
scripts with stdin model, but only on when new lines arrive.

 

It is used like this:

 

./recent_line_tail error_log | alarm_handler_script

 

This functionality could be put into tail with a single new option.
Proposed Usage (a for alert, or maybe n for new?):

 

tail -a 23 error_log

 

I propose this would check for output each 23 seconds, and if it finds
any it will cat it and stop.  If there are no lines then it would wait
another 23 seconds.

 

McQueen

 

_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to