fixed backups for the updated docker compose v2 command

This commit is contained in:
Dave Lane 2022-08-24 14:20:24 +12:00
parent 958d007053
commit 258715bcd3

View file

@ -29,7 +29,7 @@ VERBOSE=0
# #
# Stuff that should be universal for this install... # Stuff that should be universal for this install...
# where we can find this app... # where we can find this app...
#MAIN_DIR=`pwd` MAIN_DIR=/home/data/scripts/pgdbbackup
# determine today's date # determine today's date
DATE=`date '+%Y-%m-%d-%a'` DATE=`date '+%Y-%m-%d-%a'`
# determine today's date # determine today's date
@ -47,7 +47,7 @@ GREP=`which grep`
# email program # email program
MAIL=`which mail` MAIL=`which mail`
# database dump utility # database dump utility
DC=`which docker-compose` DC=`which docker`
#DEF_ARGS="-C -d -O -x" #DEF_ARGS="-C -d -O -x"
# #
# pattern for "ls" command to build list of # pattern for "ls" command to build list of
@ -136,13 +136,13 @@ delete_old() {
do_backup() { do_backup() {
FILE=$1 FILE=$1
CONTAINER=$2 CONTAINER=$2
VER=`$DC exec -T $CONTAINER pg_config --version` VER=`$DC compose exec $CONTAINER pg_config --version`
verbose "Postgres version $VER - echoing to backup: $FILE" verbose "Postgres version $VER - echoing to backup: $FILE"
echo "--" > $FILE echo "--" > $FILE
echo "-- PostgreSQL Version: $VER" >> $FILE echo "-- PostgreSQL Version: $VER" >> $FILE
echo "--" >> $FILE echo "--" >> $FILE
echo "" >> $FILE echo "" >> $FILE
CMD="$DC exec -T $CONTAINER $DUMP_CMD" CMD="$DC compose exec $CONTAINER $DUMP_CMD"
verbose "doing database dump: $CMD" verbose "doing database dump: $CMD"
$CMD >> $FILE $CMD >> $FILE
} }