Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: help need to read a listening log file

by markuhs (Scribe)
on Nov 26, 2009 at 08:13 UTC ( #809504=note: print w/replies, xml ) Need Help??

in reply to help need to read a listening log file

Hi, this is the code in <code>-tags...
#!/usr/bin/perl use strict; use warnings; my $installLogFile = $ARGV[0]; my $destinationlocation = $ARGV[1]; sleep 1 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^2: help need to read a listening log file
by jithu_indian (Initiate) on Nov 26, 2009 at 09:58 UTC
    Hi markuhs, thanks for the code , here the thing is I am automating GUI installation of application using win32 GUI module. once I click on install It will generate a log file and it took almost 40 min to 1 hr depending upon system resources. I tried the code provided by U . but it is coming once log is created and going to else coz the word 'SUCCESSFUL' only appear after 40 min , here I just want to tail the application until it reaches SUCCESSFUL , ofcourse if the installation didn't went of well we can't see the msg in log, there is constant keywork "TIME" at the end of the file ... So I want to tail the log file until it got the keyword "TIME" once it reads the keyword "TIME" then I can assume that installation is over either it is SUCCESSFUL or not, could u help in this.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://809504]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2018-06-21 14:30 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (118 votes). Check out past polls.