bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New Feature Desired for tail


From: James Youngman
Subject: Re: New Feature Desired for tail
Date: Thu, 7 May 2009 11:58:53 +0100

On Wed, May 6, 2009 at 11:15 PM, Brian McQueen <address@hidden> 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]