Created
January 31, 2018 18:45
-
-
Save neophiliac/3b2b237b93804187c53193952b00416b to your computer and use it in GitHub Desktop.
simple backup script for docker database container - to be run from cron
This file contains hidden or 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 | |
| cd ~/backups | |
| MYSQL_CONTAINER_ID=`(docker ps | grep mysql | awk '{print $1}')` | |
| NOW=`date "+%Y-%m-%dT%H_%M_%S"` | |
| docker exec $MYSQL_CONTAINER_ID /usr/bin/mysqldump -u root --password=3dodPaTXF5 --opt mediawiki > backup_$NOW.sql | |
| #this assumes that there is only one mysql container and that it has 'mysql' in its name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment