Hot answers tagged


You can use tail -f to keep reading from the file as it grows. Be careful with what you feed tail -f into. You can pipe tail -f into a filter that waits until the desired log line and quits. What won't work is if you pipe tail -f into a filter that pipes into another filter, because the intermediate filter will buffer its output. This works: : >file.log ...


It is a little harder in straight shell script, but this is what I was using for quite a while for tomcat and oc4j: perlscr=' alarm 120; open F, "<$ARGV[0]"; seek F -($ARGV[1]*80),2; while (1) {exit if (<F>=~$ARGV[2]);}' window=10 scanfor="^INFO: Server startup in \d+ ms" perl -e "$perlscr" $logfile $window "$scanfor" 2>&1 0<&1 The ...


I just recently started using the WebDriver from Selenium 2 in Java. There is a driver called HtmlUnitDriver that fully supports JavaScript but does not fire up an actual browser. It is not a light solution but it does get the job done. I've designed the code to run from the command line and save the web data to files.


Have you considered Watir? When you've added the package, you can run it as a standalone file or from irb, line-by-line after include 'watir-webdriver'. I've found it to be more responsive than selenium-webdriver, but without the test recording GUI to help work out complex test conditions.


You can add this to your script to implement the pause: perl -e 'use File::Tail; my $ref=tie *FH,"File::Tail",(name=>"/var/log/messages",maxinterval=>1); while(<FH>) { exit if /Started SocketListener/ };' It makes use of the perl File::Tail module to behave like tail -f logfile | grep Started SocketListener. Replace /var/log/message ...

Only top voted, non community-wiki answers of a minimum length are eligible