Skip to content

Instantly share code, notes, and snippets.

@ashrafsharif
ashrafsharif / xtrabackup.sh
Created January 11, 2021 05:17
A bash script to create xtrabackup full and incremental backups using cron.
#!/bin/bash
# Create a full or incremental xtrabackup
# In the cron job, set it like below:
## xtrabackup weekly full backup (Saturday, 9 PM UTC == Sunday, 5 AM MYT)
## 0 21 * * 6 /root/backups/scripts/xtrabackup.sh full > /dev/null
## xtrabackup daily incremental backup (Sunday->Friday, 9 PM UTC == Monday->Saturday, 5 AM MYT)
## 0 21 * * 0-5 /root/backups/scripts/xtrabackup.sh incremental > /dev/null
# Note:
## - For every full backup taken, all created incremental backups will be deleted.