title: Unable to delete files with Cron
body: <p>I've been working on trying to figure this out for days. Google has many answers but none of them seem to solve this problem. I was hoping someone else has had this issue and knows what to do to fix it.</p>
  
  <p>So the problem:
  I would like to delete files older than 3 days using Cron.</p>
  
  <p>My Crontab:</p>
  
  <pre><code>#       m       h       dom     mon     dow     command
  SHELL=/bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin
  */1     *       *       *       *       /root/insert.sh
  0       0       *       *       *       /root/backup.sh
  */1     *       *       *       *       find /root/backups -mtime +3 -exec /bin/rm {} \;
  </code></pre>
  
  <p>With this Crontab <code>/root/backup.sh</code> runs at midnight every night and this works. Also <code>/root/insert.sh</code> (runs a php script to move some data to another folder) works every minute.</p>
  
  <p>I went to /root/backups and manually typed <code>find /root/backups -mtime +15 -exec rm {} \;</code> that worked. It deleted all the files older than 15 days. </p>
  
  <p>To confirm that cron is running this line of code. I ran <code>tail -f /var/log/syslog | grep CRON</code> (I'm running ubuntu server 13.04)</p>
  
  <pre><code>Jul 24 07:47:01 myServer CRON[13934]: (root) CMD (find /root/backups -mtime +3 -exec rm {} \;)
  Jul 24 07:48:01 myServer CRON[13937]: (root) CMD (/root/insert.sh)
  Jul 24 07:48:01 myServer CRON[13938]: (root) CMD (find /root/backups -mtime +3 -exec rm {} \;)
  Jul 24 07:49:01 myServer CRON[13954]: (root) CMD (/root/insert.sh)
  Jul 24 07:49:01 myServer CRON[13955]: (root) CMD (find /root/backups -mtime +3 -exec /bin/rm {} \;)
  </code></pre>
  
  <p>So you can see that it is running. I've tried putting a PATH in my crontab. I've tried putting <code>/bin/rm</code> instead of <code>rm</code>. Someone has suggested making sure the end of the crontab has a CR. It does.</p>
  
  <p>Even though it's root's cron I did <code>chmod a+rwx backups</code> so anyone can modify this folder. Still no luck there.</p>
  
  <p>I've tried <code>rm -fr /root/backups</code> and <code>/bin/rm -fr /root/backups</code> in my crontab and that hasn't worked. If I do <code>/bin/rm -fr /root/backups &gt;&gt; /root/logmeplease.log 2&gt;&amp;1</code> and nothing get's logged.</p>
  
  <p>Lastly, I've tried putting this into a shell script.</p>
  
  <pre><code>#!/bin/bash
  
  PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
  
  find /root/backups -mtime +5 -exec /bin/rm {} \;
  </code></pre>
  
  <p>Again this has a CR at the bottom of the file. This script works by running manually but cron won't execute it. I've also tried <code>#!/bin/bash -l</code> and <code>#!/bin/bash -x</code> at the top.</p>
  
  <p>Is there something really simple I'm missing as to why my root's cron won't delete any files? And the syslog shows that it is running the script, or command?</p>
  
  <p>Thanks for any help on this!</p>