Ignore 'sys' table when backuping

This commit is contained in:
skimpax 2021-12-30 18:38:06 +01:00
parent 9c7c4d74e3
commit 9f81b63bcd

View file

@ -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)}} 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} for db in ${DATABASES}
do do
if [[ "$db" != "information_schema" ]] && [[ "$db" != "performance_schema" ]] && [[ "$db" != "mysql" ]] && [[ "$db" != _* ]] if [[ "$db" != "information_schema" ]] \
&& [[ "$db" != "performance_schema" ]] \
&& [[ "$db" != "mysql" ]] \
&& [[ "$db" != "sys" ]] \
&& [[ "$db" != _* ]]
then then
echo "==> Dumping database: $db" echo "==> Dumping database: $db"
FILENAME=/backup/$DATE.$db.sql FILENAME=/backup/$DATE.$db.sql