title: How to keep checking for a file until it exists, then provide a link to it
body: <p>I'm calling a Java program with a PHP system call.  The Java program takes a while to run but will eventually produce a PDF file with a known filename.</p>
  
  <p>I need to keep checking for this file until it exists and then serve up a link to it.  I assume a while loop will be involved but I don't want it to be too resource intensive.  What's a good way of doing this?</p>