You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
725 B
27 lines
725 B
4 years ago
|
#!/bin/sh
|
||
|
#
|
||
|
# this backs up the database from the wikibase-docker_mysql_1 container
|
||
|
# gnd, 2020
|
||
|
#######################################################################
|
||
|
|
||
|
# set some parameters here
|
||
|
DATUM=`date +%D|sed 's/\//_/g'`
|
||
|
CONTAINER="wikibase-docker_mysql_1"
|
||
|
DB_USER="SECRET USER NAME"
|
||
|
DB_PASS="SECRET PASSWORD"
|
||
|
DB_NAME="SECRET DB NAME"
|
||
|
|
||
|
# dump database
|
||
|
echo "Dumping $DB_NAME"
|
||
|
docker exec $CONTAINER mysqldump -u $DB_USER -p$DB_PASS $DB_NAME -r /tmp/$DB_NAME-$DATUM.sql
|
||
|
|
||
|
# copy db dump to /root
|
||
|
echo "Copying $DB_NAME"
|
||
|
docker cp $CONTAINER:/tmp/$DB_NAME-$DATUM.sql /root/$DB_NAME-$DATUM.sql
|
||
|
|
||
|
# delete the dump from the container to save up space
|
||
|
docker exec $CONTAINER rm /tmp/$DB_NAME-$DATUM.sql
|
||
|
|
||
|
# done !
|
||
|
echo "Done"
|