From 515337682835baea25565b53d1efc1a9eff9f2f2 Mon Sep 17 00:00:00 2001 From: Dave Lane Date: Fri, 25 Nov 2022 16:17:05 +1300 Subject: [PATCH] adding NICE and NICE_VAL and ability to override backup numbers in config --- dbbackup-docker-compose | 10 +++++++--- default-docker-compose.conf-sample | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/dbbackup-docker-compose b/dbbackup-docker-compose index 7dcf62a..5e08f22 100755 --- a/dbbackup-docker-compose +++ b/dbbackup-docker-compose @@ -22,9 +22,11 @@ BU_FROOT_WEEKLY=weekly BU_FROOT_MONTHLY=monthly BU_FROOT_YEARLY=yearly # +# Set backup priority: -20 highest, 0 default, 19 lowest +NICE_VAL=0 # this can be overridden at invocation BU_CONF=default-docker-compose.conf -# # output for debugging... +# output for debugging... 0 = false, 1 = true VERBOSE=0 # # Stuff that should be universal for this install... @@ -49,6 +51,8 @@ MAIL=`which mail` # database dump utility DC=`which docker-compose` #DEF_ARGS="-C -d -O -x" +# nice +NICE=`which nice` # # pattern for "ls" command to build list of # pruneable backup files... @@ -142,7 +146,7 @@ do_backup() { echo "-- PostgreSQL Version: $VER" >> $FILE echo "--" >> $FILE echo "" >> $FILE - CMD="$DC exec $CONTAINER $DUMP_CMD" + CMD="$NICE -${NICE_VAL} $DC exec $CONTAINER $DUMP_CMD" verbose "doing database dump: $CMD" $CMD >> $FILE } @@ -230,7 +234,7 @@ do_backup $FILEPATH $DC_CONTAINER message "completed backup" # compress the backup message "compressing $FILEPATH" -$GZIP $FILEPATH +$NICE -${NICE_VAL} $GZIP $FILEPATH # return to where you started from... cd $OLD_DIR # diff --git a/default-docker-compose.conf-sample b/default-docker-compose.conf-sample index 0e4c8d2..6776d5d 100644 --- a/default-docker-compose.conf-sample +++ b/default-docker-compose.conf-sample @@ -17,3 +17,18 @@ DUMP_CMD='pg_dumpall -c -U postgres' # email address to send reports to, and subject EMAIL=webmaster@oerfoundation.org EMAIL_SUBJ="Mastodon on OERu Open Postgres Backup Report" +# +# Optional overrides +# +# Default retention +#BU_TO_KEEP_HOURLY=24 +#BU_TO_KEEP_DAILY=7 +#BU_TO_KEEP_WEEKLY=4 +#BU_TO_KEEP_MONTHLY=12 +#BU_TO_KEEP_YEARLY=7 +# +# Set backup priority: -20 highest, 0 default, 19 lowest +#NICE_VAL=0 +# +# Verbosity 0 = false, 1 = true +#VERBOSE=0