Last active
March 19, 2018 10:18
-
-
Save Hotfirenet/7dbe933de6cf259e6319faf3f54e505d to your computer and use it in GitHub Desktop.
Use this shell to backup your docker mysql databases
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
#!/bin/sh | |
date=$(date +%y-%m-%d) | |
bckdir=REPLACE | |
keep_day=2 | |
container=REPLACE | |
docker exec -ti ${container} mysqldump --login-path=local --single-transaction --all-databases | gzip > "${bckdir}/${container}_${date}.sql.gz | |
find "${bckdir}"/* -mtime +${keep_day} -exec rm {} \; | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment