Add backups for mariadb nightly like we do for postgres.
This allows us to back up /backups and get a good few days database dumps on mariadb servers.
This commit is contained in:
parent
9d31407e01
commit
ef817b7d0c
3 changed files with 30 additions and 0 deletions
10
roles/mariadb_server/files/backup-database
Normal file
10
roles/mariadb_server/files/backup-database
Normal file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
# Backup a database *locally* to /backups/.
|
||||
|
||||
DB=$1
|
||||
|
||||
# Make our latest backup
|
||||
/bin/mysqldump --add-drop-database $DB | /usr/bin/xz > /backups/$DB-$(date +%F).dump.xz
|
||||
|
||||
# Also, delete the backup from a few days ago.
|
||||
rm -f /backups/$DB-$(date --date="3 days ago" +%F).dump.xz
|
Loading…
Add table
Add a link
Reference in a new issue