added mysqldump
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Niklas 2021-03-30 22:09:32 +02:00
parent 4d7df3a39e
commit 786a6f9f7e
2 changed files with 11 additions and 0 deletions

View File

@ -8,6 +8,10 @@ services:
- RCLONE_REMOTE=gdrive:/backupTest - RCLONE_REMOTE=gdrive:/backupTest
- RCLONE_CONFIG=/config/rclone.conf - RCLONE_CONFIG=/config/rclone.conf
- RESTIC_PASSWORD=repopw - RESTIC_PASSWORD=repopw
- MYSQL_USERNAME=dbuser
- MYSQL_PASSWORD=dbPassword
- MYSQL_DUMP_DB=dbName1,dbName2
- MYSQL_HOST=mariadb
volumes: volumes:
- ./mounts:/backup - ./mounts:/backup
- ./config:/config - ./config:/config

View File

@ -6,4 +6,11 @@ set -e
[ -z "${RCLONE_CONFIG}" ] && echo "\$RCLONE_CONFIG is not set" && exit 1 [ -z "${RCLONE_CONFIG}" ] && echo "\$RCLONE_CONFIG is not set" && exit 1
[ -z "${RESTIC_PASSWORD}" ] && echo "\$RESTIC_PASSWORD is not set" && exit 1 [ -z "${RESTIC_PASSWORD}" ] && echo "\$RESTIC_PASSWORD is not set" && exit 1
mkdir -p /backup/sqlDump
for db in ${MYSQL_DUMP_DB//,/ }
do
mysqldump --compact -P 3306 --host $MYSQL_HOST -u "$MYSQL_USERNAME" "-p$MYSQL_PASSWORD" "$db" > "/backup/sqlDump/$db.sql"
done
restic -r "rclone:$RCLONE_REMOTE" --verbose backup "/backup" restic -r "rclone:$RCLONE_REMOTE" --verbose backup "/backup"