hpr_hub/bin/hpr_db_backup.bash

8 lines
654 B
Bash
Executable File

#!/bin/bash
pw=$(grep -E '^\$databasePassword = ' /home/hpr/php/credentials.php | awk -F "'" '{print $2}' )
pw=${pw##* }
mysqldump --user=hpr_hpr --password="$pw" -c -e --default-character-set=utf8 --single-transaction --skip-set-charset --add-drop-database --databases hpr_hpr > /home/hpr/hpr_hpr.sql
mysqldump --databases hpr_hpr --add-drop-database --tz-utc --host=localhost --user=hpr_hpr --password="$pw" > /home/hpr/mysqldump.sql
mysqldump --user=hpr_hpr --password="$pw" -c -e --default-character-set=utf8 --single-transaction --skip-set-charset --add-drop-database --databases hpr_hpr --ignore-table=hpr_hpr.reservations > /home/hpr/www/hpr.sql