A script to backup MySQL databases and website data. Backs up all databases to individual gzipped files and each directory in WWW_DATA_DIR
to individual gzipped tar archives.
backup_env.sh
is used to set the neccessary config. This must exist next to the backup script.- Use the example here as a starting point.
backup.sh
is the script itself. Download an execute using./backup.sh
.- You're probably using this on a production server. MAKE SURE YOU KNOW WHAT IT WILL EXECUTE!
- Set
DRY_RUN
to anything other than 'false' to check what commands will execute.
Can be added as a cronjob. For example to backup at midnight where the script exists in /BACKUP use:
@midnight /BACKUP/backup.sh >/dev/null
THIS SCRIPT WAS WRITTEN TO SATISFY MY OWN NEEDS. IT HAS BEEN TESTED AND SEEMS TO WORK. I ACCEPT NO RESPONSIBILITY FOR LOST DATA.