[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
New Feature Desired for tail
From: |
Brian McQueen |
Subject: |
New Feature Desired for tail |
Date: |
Wed, 6 May 2009 15:15:35 -0700 |
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
- New Feature Desired for tail,
Brian McQueen <=