Tailing log until certain time treshold is reached?

If I got your question correctly ( while! -n "${ready}" ; do is confusing) here is an example how you can check time threshold:! /bin/sh ... timelimit=200 pausetime=10 while -z "${start_info}" ; do start_info=`grep "Ready" $LOG_FILE` sleep $pausetime timelimit=$((timelimit - $pausetime)) if $timelimit -le 0 ; then break fi done.

If I got your question correctly (while! -n "${ready}" ; do is confusing) here is an example how you can check time threshold: #! /bin/sh ... timelimit=200 pausetime=10 while -z "${start_info}" ; do start_info=`grep "Ready" $LOG_FILE` sleep $pausetime timelimit=$((timelimit - $pausetime)) if $timelimit -le 0 ; then break fi done.

For consistency, why don't you use in both places (or (( timelimit As is, it's like wearing a belt and suspenders with coveralls. – Dennis Williamson Dec 24 '10 at 16:23.

This avoids repeatedly grepping the whole file: start=$SECONDS limit=200 while read -r line do if $line =~ $ready then start_info=$line break fi if (( $SECONDS >= start + limit )) then break fi done.

I think this answer is better than mine. +1 – khachik Dec 24 '10 at 20:23 but if you don't grep the whole file, what if at the time of greping the line you are way pass server has started? – London Dec 30 '10 at 11:42 @London: The while read loop starts at the beginning of the file and reads each line.

The problem with my answer is that it doesn't hold the file open so it ends as soon as it reaches the end of the file without waiting for additional lines to be added. I think something based on Yuval's comment regarding tail -f would be better. Look through these questions to see if you find something useful.

– Dennis Williamson Dec 30 '10 at 12:04.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions