On Wed, May 6, 2009 at 11:15 PM, Brian McQueen <mcqu...@yousendit.com> wrote: > 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.
Why not use something designed for the purpose of watching log files, for example http://www.fourmilab.ch/webtools/logtail/ but ... ? James. _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils