backup-docker/entrypoint.sh
Niklas 1501de6a2f
All checks were successful
continuous-integration/drone/push Build is passing
added output when dumping db
2021-03-30 22:15:57 +02:00

18 lines
525 B
Bash
Executable File

#!/bin/sh
set -e
[ -z "${RCLONE_REMOTE}" ] && echo "\$RCLONE_REMOTE 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
mkdir -p /backup/sqlDump
for db in ${MYSQL_DUMP_DB//,/ }
do
echo "Dumping db: $db"
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"