Fix DB backup location
This commit is contained in:
parent
48c88347a9
commit
26cd35785c
1 changed files with 4 additions and 5 deletions
|
@ -16,19 +16,18 @@ do
|
||||||
|
|
||||||
container_name=${container_details[1]}
|
container_name=${container_details[1]}
|
||||||
container_id=${container_details[0]}
|
container_id=${container_details[0]}
|
||||||
backup_name=$BACKUP_DIR/$db_name-$DATE.sql
|
|
||||||
|
|
||||||
case "$container_name" in
|
case "$container_name" in
|
||||||
"mariadb")
|
"mariadb")
|
||||||
db_name=$(docker exec $container_id bash -c 'echo $MYSQL_USER')
|
db_name=$(docker exec $container_id bash -c 'echo $MYSQL_USER')
|
||||||
echo Backing up mariadb $db_name to $backup_name
|
echo Backing up mariadb $db_name
|
||||||
docker exec $container_id bash -c 'mysqldump -u $MYSQL_USER -p$MYSQL_PASSWORD --all-databases' | pv > $backup_name
|
docker exec $container_id bash -c 'mysqldump -u $MYSQL_USER -p$MYSQL_PASSWORD --all-databases' | pv > $BACKUP_DIR/$db_name-$DATE.sql
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"postgres")
|
"postgres")
|
||||||
db_name=$(docker exec $container_id bash -c 'echo $POSTGRES_USER')
|
db_name=$(docker exec $container_id bash -c 'echo $POSTGRES_USER')
|
||||||
echo Backing up postgres $db_name to $backup_name
|
echo Backing up postgres $db_name
|
||||||
docker exec $container_id bash -c 'PGPASSWORD=$POSTGRES_PASSWORD pg_dumpall -U $POSTGRES_USER' | pv > $backup_name
|
docker exec $container_id bash -c 'PGPASSWORD=$POSTGRES_PASSWORD pg_dumpall -U $POSTGRES_USER' | pv > $BACKUP_DIR/$db_name-$DATE.sql
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue