title: How do I know when the task from command line is finished?
body: <p>This is really important as I could not find anything I am looking for in Google. </p>
  
  <p>How do I know when the application (or is it more appropriate to call it a task?) executed by a command line is done? How does the PHP know if the task of copying several files are done if I do like this:</p>
  
  <pre><code> exec("cp -R /test/ /var/test/test");
  </code></pre>
  
  <p>Does the PHP script continue to go to next code even while the command is still running in background to make copies? Or does PHP script wait until the copy is finished? And how does a command line application notify the script when it's done (if it does)? There must be some kind of interaction going on. </p>