title: PHP Script to re-run itself until process completed.and then restart every week
body: <p>I've made a script that retrieves XML content from a web service. The process needs to be run once a week, but the script itself needs to be re-run about 180 times to complete the process. Each run of the script takes about 3-8 minutes. I would like it to re-run about 5 seconds after each completion. </p>
  
  <p>My current solution for this is: </p>
  
  <ul>
  <li>Task scheduler for windows opens the php page once a week. </li>
  <li>When script is run and completed, javascript makes the page restart 5 seconds after completion. </li>
  <li>When the last time of the script runs it removes the reload of the page so that it stops. </li>
  </ul>
  
  <p>The problem with this solution is that it opens a new browser window every week. Is there any good alternative ways of doing this without having to manually close down the browser? </p>
  
  <p>The reason of re-run of the script is due to script timeout settings of the php server max limit, and the possibility to after each run to see status whether any error occurred.</p>
  
  <p>I'm not using cron since it would require to do extremely many polls in order to get the process to start within 5 seconds of last time run. For the weekly start up of the script I assume it wouldn't work as long as the script uses javascript to rerun itself?</p>