1

How to make Scheduled Backups work in Magento 2?

After setting up "Scheduled Backups" in..

Magento > Shops > Configuration > Advanced > System > Settings for scheduled Backup (translated)

Screenshot of Scheduled Backup

.. and waiting. The result is no backup has been created.

  • Do I need anything extra for this? Cronjobs?
  • Where will the backup be saved?
  • Is the backup functionality working for you? Want to make sure it is in case something is going wrong.

I am using Magento 2.1.3.

1

Dears,

Though Magento has an in-built tool for the backup. I would recommend using a shell script based backup:

  • Linux native command is always faster than PHP.
  • There is no enabling and disabling of maintenance mode while running the backup script. So there is no downtime.
  • To have more Freedom. Magento2 console script is limited. What if you want to backup in Amazon S3, Google Drive, etc.? If you have an independent script you can play as you like without worrying about breaking the Magento2 system.

Here is the link to such bash script which creates a backup for your Magento2 code files & database on demand or via Cron:
https://github.com/MagePsycho/magento2-db-code-backup-bash-script

You can simply use the command as

./mage2-backup.sh --backup-db --backup-code --skip-media --src-dir=/path/to/magento2/root --dest-dir=/path/to/destination

If you want to schedule via Cron, just add the following line in your Crontab entry crontab -e

0 0 * * * /path/to/mage2-backup.sh --backup-db --backup-code --skip-media --src-dir=/path/to/magento2/root --dest-dir=/path/to/destination > /dev/null 2>&1

0 0 * * * expression means the command will run run at every midnight.

0
  1. Do I need anything extra for this? Cronjobs?

  2. Where will the backup be saved?

    • the backup will be under your /var/backups/ directory
  3. Is the backup functionality working for you? Want to make sure it is in case something is going wrong.

    • yes the backup functionality work , the only thing that you need to be sure is your backup frequency,the backup size and your server disk space so you wont max out your server disk space.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.