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