foo
This commit is contained in:
@@ -15,7 +15,7 @@ DIR_BACKUP=/mnt/NASbarracuda1TB/backup/keese/seafile # where to store the backup
|
|||||||
|
|
||||||
# mysql credentials to access databases inside seafile-mysql docker
|
# mysql credentials to access databases inside seafile-mysql docker
|
||||||
MYSQL_USER=root
|
MYSQL_USER=root
|
||||||
MYSQL_PASSWORD=mysqlrootpasswd
|
MYSQL_PASSWORD='BV$9V#5Bq!enW&ez'
|
||||||
|
|
||||||
# specify seafile-mysql docker name and temporary backup location inside the docker
|
# specify seafile-mysql docker name and temporary backup location inside the docker
|
||||||
DOCKER_SEAFILE_MYSQL=seafile-mysql
|
DOCKER_SEAFILE_MYSQL=seafile-mysql
|
||||||
@@ -40,13 +40,13 @@ mkdir -p ${DIR_BACKUP_LOGS} ${DIR_BACKUP_DB}
|
|||||||
# 1) backup seafile databases
|
# 1) backup seafile databases
|
||||||
docker exec -i ${DOCKER_SEAFILE_MYSQL} sh -c "mkdir -p ${DOCKER_BACKUP_DIR_TIMESTAMP}" # create remporary backup dir inside docker
|
docker exec -i ${DOCKER_SEAFILE_MYSQL} sh -c "mkdir -p ${DOCKER_BACKUP_DIR_TIMESTAMP}" # create remporary backup dir inside docker
|
||||||
IFS=$'\n\r' # set the IFS to a newline character, so that a whole line can be assigned to an array element
|
IFS=$'\n\r' # set the IFS to a newline character, so that a whole line can be assigned to an array element
|
||||||
DATABASES=( $(docker exec -i ${DOCKER_SEAFILE_MYSQL} sh -c "mysql -e 'show databases' -s --skip-column-names -u ${MYSQL_USER} -p${MYSQL_PASSWORD}") ) # parse database names into array
|
DATABASES=( $(docker exec -i ${DOCKER_SEAFILE_MYSQL} sh -c "mysql -e 'show databases' -s --skip-column-names -u ${MYSQL_USER} -p'${MYSQL_PASSWORD}'") ) # parse database names into array
|
||||||
|
|
||||||
# loop databases and dump tables to sql files inside temporary docker backup folder
|
# loop databases and dump tables to sql files inside temporary docker backup folder
|
||||||
for i in "${DATABASES[@]:1}"
|
for i in "${DATABASES[@]:1}"
|
||||||
do
|
do
|
||||||
:
|
:
|
||||||
docker exec -i ${DOCKER_SEAFILE_MYSQL} sh -c "mysqldump --single-transaction -h localhost -u ${MYSQL_USER} -p${MYSQL_PASSWORD} --opt ${i} > ${DOCKER_BACKUP_DIR_TIMESTAMP}/${i}.sql"
|
docker exec -i ${DOCKER_SEAFILE_MYSQL} sh -c "mysqldump --single-transaction -h localhost -u ${MYSQL_USER} -p'${MYSQL_PASSWORD}' --opt ${i} > ${DOCKER_BACKUP_DIR_TIMESTAMP}/${i}.sql"
|
||||||
done
|
done
|
||||||
|
|
||||||
# 2) copy backup database files to host and cleanup
|
# 2) copy backup database files to host and cleanup
|
||||||
|
|||||||
Reference in New Issue
Block a user