jithu_indian has asked for the wisdom of the Perl Monks concerning the following question:
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
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 filesleep 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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: help need to read a listening log file
by gmargo (Hermit) on Nov 26, 2009 at 16:40 UTC | |
|
Re: help need to read a listening log file
by spx2 (Deacon) on Nov 26, 2009 at 16:26 UTC | |
|
Re: help need to read a listening log file
by markuhs (Scribe) on Nov 26, 2009 at 08:13 UTC | |
by jithu_indian (Initiate) on Nov 26, 2009 at 09:58 UTC |