mysqlbackup.sh question

Discussion in 'HOWTO-Related Questions' started by rockie, Dec 7, 2009.

  1. rockie

    rockie New Member

    hello,

    really thanks the community for tutorial at:

    http://www.howtoforge.com/back_up_mysql_dbs_without_interruptions

    however i need to know how if i want to use this script to do backup every 3 hours and at the same time delete backup file which is older than 9 hours (3 backup version only need to be kept) ?

    i can run the cronjob every 3 hours, but my remote backup server become full of backup since it only delete files older than 2 days.

    please help.

    thanks
     
  2. topdog

    topdog Active Member

    Change this
    Code:
    for file in "$( /usr/bin/find /home/sqlbackup -type f -mtime +2 )"
    do
      /bin/rm -f $file
    done
    To this
    Code:
    /usr/bin/find /home/sqlbackup -type f -mmin +540 -exec rm -vf {} \;
     

Share This Page