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; }