On 10/26/07, <b class="gmail_sendername">Mitch Gore</b> &lt;<a href="mailto:mitchell.gore@gmail.com">mitchell.gore@gmail.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
hi,<br><br>I have a cron job that does a daily backup of my DB.&nbsp; I dont want these backups to build up so i want to delete the old ones.&nbsp; I would like to keep a back log of 3 days.&nbsp; I wrote this script and it used to work but its not anymore.
<br><br>------------------------------------------------------------------------------------------------------------------<br>FN=mythtv_backup-$(date +%Y-%m-%d_%H:%M).sql<br>DIR=/mythbackups<br><br>mysqldump -u mythtv -pmythtv mythconverg -c &gt; $DIR/$FN
<br><br># bzip our db backup so it takes alot less space<br>bzip2 $DIR/$FN<br><br>#delete any backup files that status haven&#39;t changed for over 3 days.<br>rm $(find $DIR -ctime +3 -name &quot;mythtv_backup*&quot;)<br>

<br>#copy the backups to my frontend just in case a HDD crash<br>scp /mythbackups/* myth@192.168.0.203:/mythbackups<br>------------------------------------------------------------------------------------------------------------------
<br><br>For some reason my find isnt working anymore....<br><br>------------------------------------------------------------------------------------------------------------------<br>[myth@mythtv mythbackups]$ find /mythbackups -ctime +3 -name &quot;mythtv_backup*&quot; 
<br>[myth@mythtv mythbackups]$ ls -l<br>total 22992<br>-rw-r--r-- 1 root root 2972304 Oct 22 04:47 mythtv_backup-2007-10-22_04:47.sql.bz2<br>-rw-r--r-- 1 root root 3114204 Oct 23 04:47 mythtv_backup-2007-10-23_04:47.sql.bz2

<br>-rw-r--r-- 1 root root 3384627 Oct 24 04:49 mythtv_backup-2007-10-24_04:48.sql.bz2<br>-rw-r--r-- 1 root root 3533711 Oct 25 04:47 mythtv_backup-2007-10-25_04:47.sql.bz2<br>-rw-r--r-- 1 root root 3496667 Oct 26 04:47 mythtv_backup-2007-10-26_04:
47.sql.bz2<br>-rw-rw-r-- 1 myth myth 3500124 Oct 26 15:20 mythtv_backup-2007-10-26_15:20.sql.bz2<br>-rw-rw-r-- 1 myth myth 3500095 Oct 26 15:22 mythtv_backup-2007-10-26_15:22.sql.bz2<br>------------------------------------------------------------------------------------------------------------------
<br><br>Any ideas what the issue is?<br><br>Thanks,<br>Mitchell</blockquote><div><br>Have you tried using &quot;mtime&quot; instead of &quot;ctime&quot; ? &quot;ctime&quot; indicates the time when the file&#39;s meta information (owner, permissions, etc.) was changed. &quot;mtime&quot; indicates the last modify time (&quot;ls -l&quot; displays this mtime value in its output). In any case, you can also look at the actual ctime values of the files by using &quot;ls -lc&quot; command and examine what those times are (and find out the reason for the files not being removed).
<br><br>-=Venkat=-</div></div>