backup-docker/backup.sh
Djeeberjr 505d6d4d44
All checks were successful
continuous-integration/drone/push Build is passing
added postgress support
2022-03-20 21:06:53 +01:00

22 lines
528 B
Bash
Executable File

#!/usr/bin/env sh
set -e
. /app/setup.sh
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"