adding NICE and NICE_VAL and ability to override backup numbers in config

This commit is contained in:
Dave Lane 2022-11-25 16:17:05 +13:00
parent 35f979e8fa
commit 5153376828
2 changed files with 22 additions and 3 deletions

View file

@ -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
#

View file

@ -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