title: Use PHP to create, edit and delete crontab jobs?
body: <p>Is it possible to use PHP to create, edit and delete crontab jobs?</p>
  
  <p>I know how to list the current crontab jobs of the Apache user:</p>
  
  <pre><code>$output = shell_exec('crontab -l');
  echo $output;
  </code></pre>
  
  <p>But how to add a cron job with PHP? 'crontab -e' would just open a text editor and you will have to manually edit the entries before saving the file.</p>
  
  <p>And how to delete a cron job with PHP? Again you have to manually do this by 'crontab -e'.</p>
  
  <p>With a job string like this:</p>
  
  <pre><code>$job = '0 */2 * * * /usr/bin/php5 /home/user1/work.php';
  </code></pre>
  
  <p>How do I add it to the crontab jobs list with PHP?</p>