I want a script to "wait until specified file is created and need to read the file until unless it reaches a specific line /keyword.

scenario :

I am installing a application , once it is kicked , it will create a log , the cursor should be there until the log is file reaches a specific keyword/sentence, though it is a log I don't know how much time it takes to complete writing the log file

Please help me in this scenario I wrote it like this

sleep WAIT until -f $installLogFile; chdir ($destinationlocation) || die $!; print "Changing directory to $destinationlocation\n"; chdir ('logs') || die $!; my $lastLine= `tail /1 $installLogFile`; chomp($lastLine); my $secondLastLine= `tail /2 $installLogFile`; chomp ($secondLastLine); $secondLastLine=~s/$lastLine//; chomp ($secondLastLine); if ($secondLastLine eq 'SUCCESSFUL') { print "successful\n"; } else { print " was not successful \n"; exit; }
here after the cursor reaches "sleep WAIT until -f $installLogFile;" it is reading file it is going to else part b'coz still log needs to be updated with keyword once it reaches the end of the file SUCCESSFUL which is still need to write in the log file

In reply to help need to read a listening log file by jithu_indian

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.