bash - AIX Shell function to tail a log file for a specific string or for a specific time -


i searching way accomplish on our aix v7 platform. not have strong unix(aix) background, trying write bash scripts preform repetitive functions.

very simply, bash script wait until string appears @ end of log. string exist in log elsewhere.

i have read responses similar questions , answers using options not available on our system. here responses have found: 1) uses read (-t option not available in our aix version) shell function tail log file specific string specific time

2) uses pstree (pstree not installed) unix tail solution waiting specific string or quitting after timeout

3) uses timeout (timeout not installed) run tail -f specific time in bash script

4) uses tail --pid (--pid option not available)

you can try

tail -f -n0 "$yourfile" | grep -ql "yourstring" 

on linux, works (almost) expected. tail -f -n0 produces lines added file, grep -ql quietly looks single match of "yourstring" in input , exits afterwards.


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -