backup-docker/backup.sh
Djeeberjr 5f8248d236
All checks were successful
continuous-integration/drone/push Build is passing
added entrypoint
2022-03-27 01:31:46 +01:00

20 lines
511 B
Bash
Executable File

#!/usr/bin/env sh
set -e
mkdir -p /backup/sqlDump
for db in $(echo "$MYSQL_DUMP_DB" | sed 's/,/\n/g')
do
echo "Dumping db: $db"
mysqldump --compact -P 3306 --host "$MYSQL_HOST" -u "$MYSQL_USERNAME" "-p$MYSQL_PASSWORD_ACTUAL" "$db" > "/backup/sqlDump/$db-mysql.sql"
done
for db in $(echo "$POSTGRES_DUMP_DB" | sed 's/,/\n/g')
do
echo "Dumping db: $db"
pg_dump -U "$POSTGRES_USERNAME" --host "$POSTGRES_HOST" "$db" > "/backup/sqlDump/$db-postgres.sql"
done
restic --verbose backup "/backup"