backup-docker/backup.sh

20 lines
511 B
Bash
Raw Normal View History

2021-11-10 20:27:49 +00:00
#!/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"
2022-03-20 20:06:53 +00:00
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"
2021-11-10 20:27:49 +00:00
done
restic --verbose backup "/backup"