[mythtv-users] backup script -- remove old backups.

Mitch Gore mitchell.gore at gmail.com
Fri Oct 26 21:36:15 UTC 2007


hi,

I have a cron job that does a daily backup of my DB.  I dont want these
backups to build up so i want to delete the old ones.  I would like to keep
a back log of 3 days.  I wrote this script and it used to work but its not
anymore.

------------------------------------------------------------------------------------------------------------------
FN=mythtv_backup-$(date +%Y-%m-%d_%H:%M).sql
DIR=/mythbackups

mysqldump -u mythtv -pmythtv mythconverg -c > $DIR/$FN

# bzip our db backup so it takes alot less space
bzip2 $DIR/$FN

#delete any backup files that status haven't changed for over 3 days.
rm $(find $DIR -ctime +3 -name "mythtv_backup*")

#copy the backups to my frontend just in case a HDD crash
scp /mythbackups/* myth at 192.168.0.203:/mythbackups
------------------------------------------------------------------------------------------------------------------

For some reason my find isnt working anymore....

------------------------------------------------------------------------------------------------------------------
[myth at mythtv mythbackups]$ find /mythbackups -ctime +3 -name
"mythtv_backup*"
[myth at mythtv mythbackups]$ ls -l
total 22992
-rw-r--r-- 1 root root 2972304 Oct 22 04:47 mythtv_backup-2007-10-22_04:
47.sql.bz2
-rw-r--r-- 1 root root 3114204 Oct 23 04:47 mythtv_backup-2007-10-23_04:
47.sql.bz2
-rw-r--r-- 1 root root 3384627 Oct 24 04:49 mythtv_backup-2007-10-24_04:
48.sql.bz2
-rw-r--r-- 1 root root 3533711 Oct 25 04:47 mythtv_backup-2007-10-25_04:
47.sql.bz2
-rw-r--r-- 1 root root 3496667 Oct 26 04:47 mythtv_backup-2007-10-26_04:
47.sql.bz2
-rw-rw-r-- 1 myth myth 3500124 Oct 26 15:20 mythtv_backup-2007-10-26_15:
20.sql.bz2
-rw-rw-r-- 1 myth myth 3500095 Oct 26 15:22 mythtv_backup-2007-10-26_15:
22.sql.bz2
------------------------------------------------------------------------------------------------------------------


Any ideas what the issue is?

Thanks,
Mitchell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20071026/4895b47c/attachment.htm 


More information about the mythtv-users mailing list