[Bps-public-commit] postgresql_auto_backup_s3 branch update-for-hostedrt-backups updated. f9a2f7dfc2a264b6ba12541adeb39e56cb808c21

BPS Git Server git at git.bestpractical.com
Fri Mar 11 21:30:28 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "postgresql_auto_backup_s3".

The branch, update-for-hostedrt-backups has been updated
       via  f9a2f7dfc2a264b6ba12541adeb39e56cb808c21 (commit)
      from  5686cdb025b0f0f6de99ae67336312defcfcca35 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f9a2f7dfc2a264b6ba12541adeb39e56cb808c21
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Fri Mar 11 15:27:27 2022 -0600

    Fix -c option to load config
    
    The -c option to load a non-default config file didn't work for
    pg_backup.sh.  This commit copies the logic from
    pg_backup_rotated.sh over to pg_backup.sh, which does work.

diff --git a/pg_backup.sh b/pg_backup.sh
index 93acb14..a44e3b7 100644
--- a/pg_backup.sh
+++ b/pg_backup.sh
@@ -3,17 +3,12 @@
 ###########################
 ####### LOAD CONFIG #######
 ###########################
- 
+
 while [[ "$#" -gt "0" ]]; do
         case $1 in
                 -c)
-                        if [[ -r "$2" ]]; then
-                                source "$2"
-                                shift 2
-                        else
-                                ${ECHO} "Unreadable config file \"$2\"" 1>&2
-                                exit 1
-                        fi
+                        CONFIG_FILE_PATH="$2"
+                        shift 2
                         ;;
                 *)
                         ${ECHO} "Unknown Option \"$1\"" 1>&2
@@ -21,13 +16,21 @@ while [[ "$#" -gt "0" ]]; do
                         ;;
         esac
 done
- 
-if [[ "$#" -eq "0" ]]; then
+
+if [[ -z "$CONFIG_FILE_PATH" ]]; then
         SCRIPT=`realpath $0`
         SCRIPTPATH=`dirname $SCRIPT`
-        source $SCRIPTPATH/pg_backup.config
-fi;
- 
+        CONFIG_FILE_PATH="${SCRIPTPATH}/pg_backup.config"
+fi
+
+if [[ ! -r "${CONFIG_FILE_PATH}" ]]; then
+        echo "Could not load config file from ${CONFIG_FILE_PATH}" 1>&2
+        exit 1
+fi
+
+source "${CONFIG_FILE_PATH}"
+
+
 ###########################
 #### PRE-BACKUP CHECKS ####
 ###########################
-----------------------------------------------------------------------

Summary of changes:
 pg_backup.sh | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
postgresql_auto_backup_s3


More information about the Bps-public-commit mailing list