Created
November 1, 2017 16:55
-
-
Save salaros/aec1e6dc9a87f60bad739976bbdcd041 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO use a dedicated backup user, protect gzip file with password etc | |
echo "/var/backups/all-databases.sql.gz { | |
daily | |
rotate 8 | |
nocompress | |
create 640 root adm | |
postrotate | |
mysqldump -uroot --all-databases > /var/backups/all-databases.sql --single-transaction | |
gzip -9f /var/backups/all-databases.sql.sql | |
endscript | |
}" > /etc/logrotate.d/mysql-all-databases | |
touch /var/backups/all-databases.sql.gz | |
logrotate -f /etc/logrotate.d/mysql-all-databases |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment