backup-fix
This commit is contained in:
parent
c3ef02e97f
commit
15939f86b4
@ -208,9 +208,14 @@
|
|||||||
|
|
||||||
for i in $(echo "show databases" | mariadb -u root -h mariadb.{{inventory_hostname}} --ssl --ssl-verify-server-cert -P 33306 -p${MARIADB_ROOT_PASSWORD} | grep -v "^Database$")
|
for i in $(echo "show databases" | mariadb -u root -h mariadb.{{inventory_hostname}} --ssl --ssl-verify-server-cert -P 33306 -p${MARIADB_ROOT_PASSWORD} | grep -v "^Database$")
|
||||||
do
|
do
|
||||||
mariadb-dump -u root -h mariadb.{{inventory_hostname}} --ssl --ssl-verify-server-cert -P 33306 -p${MARIADB_ROOT_PASSWORD} $i >${g_tmp}/dberr | gzip > $BACKUPDIR/MARIADB-$i-$TIMESTAMP.sql.gz || g_echo_error "MariaDB Backup failed $(cat ${g_tmp}/dberr)"
|
if mariadb-dump -u root -h mariadb.{{inventory_hostname}} --ssl --ssl-verify-server-cert -P 33306 -p${MARIADB_ROOT_PASSWORD} $i 2>${g_tmp}/dberr >$BACKUPDIR/MARIADB-$i-$TIMESTAMP.sql
|
||||||
|
then
|
||||||
|
gzip $BACKUPDIR/MARIADB-$i-$TIMESTAMP.sql
|
||||||
|
else
|
||||||
|
g_echo_error "MariaDB Backup failed $(cat ${g_tmp}/dberr)"
|
||||||
|
fi
|
||||||
# dont delete last old backups!
|
# dont delete last old backups!
|
||||||
OLD_BACKUPS=$(ls -1 $BACKUPDIR/$i*.gz | wc -l)
|
OLD_BACKUPS=$(ls -1 $BACKUPDIR/MARIADB-$i*.gz | wc -l)
|
||||||
if [ $OLD_BACKUPS -gt $DAYS ]
|
if [ $OLD_BACKUPS -gt $DAYS ]
|
||||||
then
|
then
|
||||||
find $BACKUPDIR -name "MARIADB-$i*.gz" -daystart -mtime +$DAYS -delete
|
find $BACKUPDIR -name "MARIADB-$i*.gz" -daystart -mtime +$DAYS -delete
|
||||||
|
Loading…
Reference in New Issue
Block a user