mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-22 05:33:53 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71802d2a28 | ||
|
|
c96a2179b5 | ||
|
|
42d3aa0fef |
@@ -1,3 +1,8 @@
|
|||||||
|
## 1.18.2 2020-04-08 <hyun007 @ github>
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Rework to allow passwords with spaces in them for MariaDB / MySQL
|
||||||
|
|
||||||
## 1.18.1 2020-03-14 <dave at tiredofit dot ca>
|
## 1.18.1 2020-03-14 <dave at tiredofit dot ca>
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2019 Dave Conroy
|
Copyright (c) 2020 Dave Conroy
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
|
||||||
source /assets/functions/*
|
for s in /assets/functions/*; do source $s; done
|
||||||
PROCESS_NAME="db-backup"
|
PROCESS_NAME="db-backup"
|
||||||
|
|
||||||
date >/dev/null
|
date >/dev/null
|
||||||
@@ -65,7 +65,7 @@ fi
|
|||||||
"mysql" | "MYSQL" | "mariadb" | "MARIADB")
|
"mysql" | "MYSQL" | "mariadb" | "MARIADB")
|
||||||
DBTYPE=mysql
|
DBTYPE=mysql
|
||||||
DBPORT=${DB_PORT:-3306}
|
DBPORT=${DB_PORT:-3306}
|
||||||
[[ ( -n "${DB_PASS}" ) ]] && MYSQL_PASS_STR=" -p'${DBPASS}'"
|
[[ ( -n "${DB_PASS}" ) ]] && export MYSQL_PWD=${DBPASS}
|
||||||
;;
|
;;
|
||||||
"postgres" | "postgresql" | "pgsql" | "POSTGRES" | "POSTGRESQL" | "PGSQL" )
|
"postgres" | "postgresql" | "pgsql" | "POSTGRES" | "POSTGRESQL" | "PGSQL" )
|
||||||
DBTYPE=pgsql
|
DBTYPE=pgsql
|
||||||
@@ -96,20 +96,20 @@ function backup_couch() {
|
|||||||
|
|
||||||
function backup_mysql() {
|
function backup_mysql() {
|
||||||
if [ "$SPLIT_DB" = "TRUE" ] || [ "$SPLIT_DB" = "true" ]; then
|
if [ "$SPLIT_DB" = "TRUE" ] || [ "$SPLIT_DB" = "true" ]; then
|
||||||
DATABASES=`mysql -h ${DBHOST} -P $DBPORT -u$DBUSER -p"${DBPASS}" --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
|
for db in $DATABASES; do
|
||||||
if [[ "$db" != "information_schema" ]] && [[ "$db" != _* ]] ; then
|
if [[ "$db" != "information_schema" ]] && [[ "$db" != _* ]] ; then
|
||||||
echo "** [db-backup] Dumping database: $db"
|
echo "** [db-backup] Dumping database: $db"
|
||||||
TARGET=mysql_${db}_${DBHOST}_${now}.sql
|
TARGET=mysql_${db}_${DBHOST}_${now}.sql
|
||||||
mysqldump --max-allowed-packet=512M -h $DBHOST -P $DBPORT -u$DBUSER ${MYSQL_PASS_STR} --databases $db > ${TMPDIR}/${TARGET}
|
mysqldump --max-allowed-packet=512M -h $DBHOST -P $DBPORT -u$DBUSER --databases $db > ${TMPDIR}/${TARGET}
|
||||||
generate_md5
|
generate_md5
|
||||||
compression
|
compression
|
||||||
move_backup
|
move_backup
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
mysqldump --max-allowed-packet=512M -A -h $DBHOST -P $DBPORT -u$DBUSER ${MYSQL_PASS_STR} > ${TMPDIR}/${TARGET}
|
mysqldump --max-allowed-packet=512M -A -h $DBHOST -P $DBPORT -u$DBUSER > ${TMPDIR}/${TARGET}
|
||||||
generate_md5
|
generate_md5
|
||||||
compression
|
compression
|
||||||
move_backup
|
move_backup
|
||||||
|
|||||||
Reference in New Issue
Block a user