Magento Admin Scheduled Backups Creating Multiple Backups – Fix

backupmagento-1.9

I have setup of Database daily backup every night at 12:30am, through Admin's System>Configuration>Advanced>System>Scheduled Backup Settings.

Magento backs up the data base. But it creates 4 of the same backup files, instead of just one. I started this two nights ago, and it has done it consistently for the past 2 nights. 4 database backups every night at around 12:30, 12:31, 12:32 and 12:33!

How can I stop that from happening and make it to create one back up file?

System>Configuration>Advanced>System>Cron (Scheduled Tasks)

Generate Schedules Every: 15
Schedule Ahead for: 20
Missed if Not Run Within: 15
History Cleanup Every: 10
Success History Lifetime: 60
Failure History Lifetime: 600

The following is the cron i have on the server:

* * * * * wget -O /dev/null -q http://domainDOTcom/path/to/magento/cron.php

Best Answer

Couple of things here.

  1. Never use the inbuilt backup tool. Its flawed in far too many ways to be useful. Instead, use conventional server tools to dump the DB and backup the files.

    Eg. Some Magento specific tools for DB dumping

    Or generic tools for MySQL dumping

    And for file backups, use things like rsync or tar to generate backups,

    Eg.

    • Using tar

      tar cvfz /path/to/backup.tgz /path/to/public_html \
        --exclude='/var/log' \
        --exclude='/var/session' \
        --exclude='/var/cache' \
        --exclude='/var/backup' \
        --exclude='/var/report' \
        --exclude='/media/catalog/product/cache'
      
    • Using rsync

      rsync -vPa /path/to/public_html/ /path/to/backup_html/  \
        --exclude='/var/log' \
        --exclude='/var/session' \
        --exclude='/var/cache' \
        --exclude='/var/backup' \
        --exclude='/var/report' \
        --exclude='/media/catalog/product/cache'
      
  2. You should never execute your cron via wget - you should be using the cron.sh wrapper to execute it,

    * * * * * /bin/bash /path/to/public_html/cron.sh
    
Related Topic