HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Programming/Scripts (http://www.howtoforge.com/forums/forumdisplay.php?f=7)
-   -   Start process & check log until start line found? (http://www.howtoforge.com/forums/showthread.php?t=54901)

naffcat 11th November 2011 23:07

Start process & check log until start line found?
 
Hi,

Can anyone help, I need to write a linux shell script which will either tail a log until a particular line appears (with for example "started") or perhaps have a script which has a loop - sleep - grepp check for line - then exit if found.

I imagine this kind of thing has been done before and there's probably more than one way to do it but would appreaciate any examples

Many thanks

:confused:

nbhadauria 14th November 2011 16:19

simple thought use grep -B100000000000 "started"

naffcat 14th November 2011 16:40

Thanks - problem is there are previous instances of "started" within the log - that's why I was hoping someone might have come across this before - and have some kind of check / sleep / loop until found after present time.

nbhadauria 14th November 2011 16:52

:p ok. then something like this .

if grep -q "string" file; then

Also try http://sourceforge.net/projects/swatch/


All times are GMT +2. The time now is 07:30.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.