Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 11th November 2011, 23:07
naffcat naffcat is offline
Junior Member
 
Join Date: Aug 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Question 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

Reply With Quote
Sponsored Links
  #2  
Old 14th November 2011, 16:19
nbhadauria nbhadauria is offline
Member
 
Join Date: Aug 2010
Location: New Delhi, India
Posts: 79
Thanks: 1
Thanked 13 Times in 13 Posts
Send a message via Skype™ to nbhadauria
Default

simple thought use grep -B100000000000 "started"
Reply With Quote
  #3  
Old 14th November 2011, 16:40
naffcat naffcat is offline
Junior Member
 
Join Date: Aug 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Question

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.
Reply With Quote
  #4  
Old 14th November 2011, 16:52
nbhadauria nbhadauria is offline
Member
 
Join Date: Aug 2010
Location: New Delhi, India
Posts: 79
Thanks: 1
Thanked 13 Times in 13 Posts
Send a message via Skype™ to nbhadauria
 
Default

ok. then something like this .

if grep -q "string" file; then

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

Last edited by nbhadauria; 15th November 2011 at 16:38.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
coexistence of php4 and php5 on ISPC3 AceLine Tips/Tricks/Mods 5 5th November 2010 14:56
Being Spammed/Hacked/Probed not sure PLEASE HELP! kresser General 10 29th October 2010 17:25
Forbidden 403; Samba access; config of maildeamon fawkes Installation/Configuration 4 14th January 2010 18:16
ISP Config hesitation when opening web pages frankb Installation/Configuration 7 15th December 2008 13:06
slow download through webserver problem snewp Technical 14 9th May 2008 05:25


All times are GMT +2. The time now is 20:55.


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