title: Amazon S3 Backup
body: <p>In php what is the best way to run a script after one has finished for exmaple i have these two files.</p>
  
  <p>My backup file.</p>
  
  <pre><code>&lt;?php
  require 'back-up.php'; 
  
  #!/bin/php -d max_execution_time = 3600 
  
  $backup_dirs = array('../bu/'); 
  $backup = new backupclass($backup_dirs); 
  $backup-&gt;backup('filesys','files/');
  ?&gt;
  </code></pre>
  
  <p>The i have my amazon s3 upload file.</p>
  
  <pre><code>&lt;?php
  
  require_once('S3.php');
  
  $s3 = new S3('S3KEY', 'S3SECRETKEY');
  
  $baseurl = "/home/mlcreative/public_html/bu/files";
  
  if ($handle = opendir('./files/')) {
      while (false !== ($file = readdir($handle))) {
          if ($file != "." &amp;&amp; $file != "..") {
  
              if ($s3-&gt;putObjectFile("files/$file", "testingmlc333", "lighthouse/$file", S3::ACL_PUBLIC_READ)) {
  
                      echo "&lt;strong&gt;We successfully uploaded your file.&lt;/strong&gt;";
                      if (file_exists($baseurl . '/' . $file)) { unlink ($baseurl . '/' . $file); }
  }else{
                      echo "&lt;strong&gt;Something went wrong while uploading your file... sorry.&lt;/strong&gt;";
  }
  
          }
      }
      closedir($handle);
  }
  
  ?&gt;
  </code></pre>
  
  <p>Ok so at the moment i have a cron job setup to running the backup php file then an hour later run the amazon upload php file.</p>
  
  <p>What i am asking is how i could combine these to script so i only have to run one cron job instead of two???</p>
  
  <p>Any help please</p>