Created
April 4, 2018 04:32
-
-
Save binhp/f6c41db44aa243110dc647514c1ed356 to your computer and use it in GitHub Desktop.
Backup Daily with logrotate
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
## sudo touch /var/backup/dbname.sql.gz | |
## test | |
## sudo logrotate -f /etc/logrotate.d/mysqlbackup | |
## sudo vi /etc/logrotate.d/mysqlbackup | |
/var/backup/dbname.sql.gz { | |
daily | |
rotate 7 | |
nocompress | |
create 640 root root | |
postrotate | |
mysqldump -u dbuser dbname |gzip > /var/backup/dbname.sql.gz | |
echo "Backup at `date`" > /var/backup/dbname.log | |
endscript | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment