#!/bin/sh # # MySQL database backup script # set -e db_name="<target-database>" db_user="<database-user>" db_pass="<database-password>" db_dir="<target-dir-for-dumps>" shared_params="--compatible=mysql40 --compact" # generate a new schema mysqldump -u $db_user --password=$db_pass $shared_params --no-data $db_name > $db_dir/$db_name.structure.sql mysqldump -u $db_user --password=$db_pass $shared_params --no-create-info --skip-extended-insert $db_name > $db_dir/$db_name.skip-extended-insert.sql git add $db_dir/$db_name.skip-extended-insert.sql git add $db_dir/$db_name.structure.sql # Exit success exit 0