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

Jonathan Tidmore jtidmore at gmail.com
Fri Nov 2 04:40:28 UTC 2007


Your most recent backups are owned by myth user.  Are you running this
script as myth?  If so, it won't be able to delete the older ones
owned by root.  chown to myth and the script should work fine.

J

On Oct 26, 2007 2:36 PM, Mitch Gore <mitchell.gore at gmail.com> wrote:
> 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
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>
>



-- 
Jonathan Tidmore


More information about the mythtv-users mailing list