mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-21 21:33:28 +01:00
Release 3.0.16 - See CHANGELOG.md
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
## 3.0.16 2022-03-23 <dave at tiredofit dot ca>
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Fix for SPLIT_DB not looping through all databse names properly
|
||||||
|
|
||||||
|
|
||||||
## 3.0.15 2022-03-22 <dave at tiredofit dot ca>
|
## 3.0.15 2022-03-22 <dave at tiredofit dot ca>
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -139,16 +139,15 @@ backup_mysql() {
|
|||||||
fi
|
fi
|
||||||
if var_true "${SPLIT_DB}" ; then
|
if var_true "${SPLIT_DB}" ; then
|
||||||
DATABASES=$(mysql -h ${dbhost} -P $dbport -u$dbuser --batch -e "SHOW DATABASES;" | grep -v Database | grep -v schema)
|
DATABASES=$(mysql -h ${dbhost} -P $dbport -u$dbuser --batch -e "SHOW DATABASES;" | grep -v Database | grep -v schema)
|
||||||
for db in "${DATABASES}" ; do
|
print_debug "Backing up everything except for information_schema and _* prefixes"
|
||||||
|
print_debug "Databases Found: ${DATABASES}"
|
||||||
|
for db in ${DATABASES} ; do
|
||||||
if [[ "$db" != "information_schema" ]] && [[ "$db" != _* ]] ; then
|
if [[ "$db" != "information_schema" ]] && [[ "$db" != _* ]] ; then
|
||||||
print_debug "Backing up everything except for information_schema and _* prefixes"
|
|
||||||
print_notice "Dumping MySQL/MariaDB database: '${db}'"
|
print_notice "Dumping MySQL/MariaDB database: '${db}'"
|
||||||
target=mysql_${db}_${dbhost}_${now}.sql
|
target=mysql_${db}_${dbhost}_${now}.sql
|
||||||
compression
|
compression
|
||||||
set -x
|
|
||||||
mysqldump --max-allowed-packet=${MYSQL_MAX_ALLOWED_PACKET} -h $dbhost -P $dbport -u$dbuser ${single_transaction} ${stored_procedures} ${EXTRA_OPTS} --databases $db | $compress_cmd > "${TEMP_LOCATION}"/"${target}"
|
mysqldump --max-allowed-packet=${MYSQL_MAX_ALLOWED_PACKET} -h $dbhost -P $dbport -u$dbuser ${single_transaction} ${stored_procedures} ${EXTRA_OPTS} --databases $db | $compress_cmd > "${TEMP_LOCATION}"/"${target}"
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
set +x
|
|
||||||
check_exit_code
|
check_exit_code
|
||||||
generate_checksum
|
generate_checksum
|
||||||
move_backup
|
move_backup
|
||||||
@@ -168,11 +167,11 @@ backup_mysql() {
|
|||||||
backup_pgsql() {
|
backup_pgsql() {
|
||||||
export PGPASSWORD=${dbpass}
|
export PGPASSWORD=${dbpass}
|
||||||
if var_true "${SPLIT_DB}" ; then
|
if var_true "${SPLIT_DB}" ; then
|
||||||
|
|
||||||
authdb=${DB_USER}
|
authdb=${DB_USER}
|
||||||
[ -n "${DB_NAME}" ] && authdb=${DB_NAME}
|
[ -n "${DB_NAME}" ] && authdb=${DB_NAME}
|
||||||
DATABASES=$(psql -h $dbhost -U $dbuser -p ${dbport} -d ${authdb} -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' )
|
DATABASES=$(psql -h $dbhost -U $dbuser -p ${dbport} -d ${authdb} -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' )
|
||||||
for db in "${DATABASES}"; do
|
print_debug "Databases Found: ${DATABASES}"
|
||||||
|
for db in $DATABASES ; do
|
||||||
print_notice "Dumping Postgresql database: $db"
|
print_notice "Dumping Postgresql database: $db"
|
||||||
target=pgsql_${db}_${dbhost}_${now}.sql
|
target=pgsql_${db}_${dbhost}_${now}.sql
|
||||||
compression
|
compression
|
||||||
@@ -184,7 +183,7 @@ backup_pgsql() {
|
|||||||
done
|
done
|
||||||
else
|
else
|
||||||
compression
|
compression
|
||||||
print_notice "Dumping PostgreSQL: '${DB_NAME}'"
|
print_notice "Dumping PostgreSQL database: '${DB_NAME}'"
|
||||||
pg_dump -h ${dbhost} -U ${dbuser} -p ${dbport} ${dbname} ${EXTRA_OPTS} | $compress_cmd > ${TEMP_LOCATION}/${target}
|
pg_dump -h ${dbhost} -U ${dbuser} -p ${dbport} ${dbname} ${EXTRA_OPTS} | $compress_cmd > ${TEMP_LOCATION}/${target}
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
check_exit_code
|
check_exit_code
|
||||||
|
|||||||
Reference in New Issue
Block a user