mirror of
https://github.com/fradelg/docker-mysql-cron-backup.git
synced 2024-11-01 08:31:45 +01:00
Ignore 'sys' table when backuping
This commit is contained in:
parent
9c7c4d74e3
commit
9f81b63bcd
1 changed files with 5 additions and 1 deletions
|
@ -12,7 +12,11 @@ echo "=> Backup started at $(date "+%Y-%m-%d %H:%M:%S")"
|
|||
DATABASES=${MYSQL_DATABASE:-${MYSQL_DB:-$(mysql -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" -e "SHOW DATABASES;" | tr -d "| " | grep -v Database)}}
|
||||
for db in ${DATABASES}
|
||||
do
|
||||
if [[ "$db" != "information_schema" ]] && [[ "$db" != "performance_schema" ]] && [[ "$db" != "mysql" ]] && [[ "$db" != _* ]]
|
||||
if [[ "$db" != "information_schema" ]] \
|
||||
&& [[ "$db" != "performance_schema" ]] \
|
||||
&& [[ "$db" != "mysql" ]] \
|
||||
&& [[ "$db" != "sys" ]] \
|
||||
&& [[ "$db" != _* ]]
|
||||
then
|
||||
echo "==> Dumping database: $db"
|
||||
FILENAME=/backup/$DATE.$db.sql
|
||||
|
|
Loading…
Reference in a new issue