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

BPS Git Server git at git.bestpractical.com
Fri Mar 11 21:20:21 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  5686cdb025b0f0f6de99ae67336312defcfcca35 (commit)
      from  6e5258167dbde23458e09010f1be4c1526f93d02 (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 5686cdb025b0f0f6de99ae67336312defcfcca35
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Fri Mar 11 15:19:24 2022 -0600

    Convert tabs to spaces (retab)

diff --git a/pg_backup.sh b/pg_backup.sh
index 4e7817b..93acb14 100644
--- a/pg_backup.sh
+++ b/pg_backup.sh
@@ -34,8 +34,8 @@ fi;
  
 # Make sure we're running as the required backup user
 if [[ "$BACKUP_USER" != "" && "$(id -un)" != "$BACKUP_USER" ]]; then
-	echo "This script must be run as $BACKUP_USER. Exiting." 1>&2
-	exit 1;
+        echo "This script must be run as $BACKUP_USER. Exiting." 1>&2
+        exit 1;
 fi;
  
  
@@ -44,11 +44,11 @@ fi;
 ###########################
  
 if [[ -z "$HOSTNAME" ]]; then
-	HOSTNAME="localhost"
+        HOSTNAME="localhost"
 fi;
  
 if [[ -z "$USERNAME" ]]; then
-	USERNAME="postgres"
+        USERNAME="postgres"
 fi;
  
  
@@ -62,8 +62,8 @@ FINAL_BACKUP_DIR=$BACKUP_DIR"`date +\%Y-\%m-\%d`/"
 echo "Making backup directory in $FINAL_BACKUP_DIR"
  
 if ! mkdir -p $FINAL_BACKUP_DIR; then
-	echo "Cannot create backup directory in $FINAL_BACKUP_DIR. Go and fix it!" 1>&2
-	exit 1;
+        echo "Cannot create backup directory in $FINAL_BACKUP_DIR. Go and fix it!" 1>&2
+        exit 1;
 fi;
  
  
diff --git a/pg_backup_rotated.sh b/pg_backup_rotated.sh
index 675ca7b..f0f2421 100644
--- a/pg_backup_rotated.sh
+++ b/pg_backup_rotated.sh
@@ -36,8 +36,8 @@ source "${CONFIG_FILE_PATH}"
  
 # Make sure we're running as the required backup user
 if [[ "$BACKUP_USER" != "" && "$(id -un)" != "$BACKUP_USER" ]]; then
-	echo "This script must be run as $BACKUP_USER. Exiting." 1>&2
-	exit 1
+        echo "This script must be run as $BACKUP_USER. Exiting." 1>&2
+        exit 1
 fi
  
  
@@ -46,11 +46,11 @@ fi
 ###########################
  
 if [[ -z "$HOSTNAME" ]]; then
-	HOSTNAME="localhost"
+        HOSTNAME="localhost"
 fi;
  
 if [[ -z "$USERNAME" ]]; then
-	USERNAME="postgres"
+        USERNAME="postgres"
 fi;
  
  
@@ -60,37 +60,37 @@ fi;
  
 function perform_backups()
 {
-	SUFFIX=$1
-	FINAL_BACKUP_DIR=$BACKUP_DIR"`date +\%Y\%m\%d`$SUFFIX-"
+        SUFFIX=$1
+        FINAL_BACKUP_DIR=$BACKUP_DIR"`date +\%Y\%m\%d`$SUFFIX-"
  
-	#echo "Making backup directory in $FINAL_BACKUP_DIR"
+        #echo "Making backup directory in $FINAL_BACKUP_DIR"
  
-	#if ! mkdir -p $FINAL_BACKUP_DIR; then
-	#	echo "Cannot create backup directory in $FINAL_BACKUP_DIR. Go and fix it!" 1>&2
-	#	exit 1;
-	#fi;
+        #if ! mkdir -p $FINAL_BACKUP_DIR; then
+        #       echo "Cannot create backup directory in $FINAL_BACKUP_DIR. Go and fix it!" 1>&2
+        #       exit 1;
+        #fi;
  
  
-	###########################
-	###### FULL BACKUPS #######
-	###########################
+        ###########################
+        ###### FULL BACKUPS #######
+        ###########################
  
-	echo -e "\n\nPerforming full backups"
-	echo -e "--------------------------------------------\n"
+        echo -e "\n\nPerforming full backups"
+        echo -e "--------------------------------------------\n"
  
-	for DATABASE in ${BACKUP_DB_LIST//,/ }
-	do
-	        echo "$DATABASE"
+        for DATABASE in ${BACKUP_DB_LIST//,/ }
+        do
+                echo "$DATABASE"
 
-		if ! ( pg_dump -Fp -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" --table=sessions --schema-only; pg_dump -Fp -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" --exclude-table=sessions ) | gzip --stdout | s3cmd --reduced-redundancy put - $FINAL_BACKUP_DIR"$DATABASE".sql.gz.in_progress --no-encrypt; then
-	                echo "[!!ERROR!!] Failed to produce backup of database $DATABASE" 1>&2
-	        else
-	                s3cmd mv $FINAL_BACKUP_DIR"$DATABASE".sql.gz.in_progress $FINAL_BACKUP_DIR"$DATABASE".sql.gz
-	        fi
+                if ! ( pg_dump -Fp -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" --table=sessions --schema-only; pg_dump -Fp -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" --exclude-table=sessions ) | gzip --stdout | s3cmd --reduced-redundancy put - $FINAL_BACKUP_DIR"$DATABASE".sql.gz.in_progress --no-encrypt; then
+                        echo "[!!ERROR!!] Failed to produce backup of database $DATABASE" 1>&2
+                else
+                        s3cmd mv $FINAL_BACKUP_DIR"$DATABASE".sql.gz.in_progress $FINAL_BACKUP_DIR"$DATABASE".sql.gz
+                fi
  
-	done
+        done
  
-	echo -e "\nAll database backups complete!"
+        echo -e "\nAll database backups complete!"
 }
  
 # MONTHLY BACKUPS
@@ -99,12 +99,12 @@ DAY_OF_MONTH=`date +%d`
  
 if [[ "$DAY_OF_MONTH" -eq "1" ]];
 then
-	# Delete all expired monthly directories
-	find $BACKUP_DIR -maxdepth 1 -name "*-monthly" -exec rm -rf '{}' ';'
+        # Delete all expired monthly directories
+        find $BACKUP_DIR -maxdepth 1 -name "*-monthly" -exec rm -rf '{}' ';'
  
-	perform_backups "-monthly"
+        perform_backups "-monthly"
  
-	exit 0;
+        exit 0;
 fi
  
 # WEEKLY BACKUPS
@@ -114,12 +114,12 @@ EXPIRED_DAYS=`expr $((($WEEKS_TO_KEEP * 7) + 1))`
  
 if [[ "$DAY_OF_WEEK" -eq "$DAY_OF_WEEK_TO_KEEP" ]];
 then
-	# Delete all expired weekly directories
-	find $BACKUP_DIR -maxdepth 1 -mtime +$EXPIRED_DAYS -name "*-weekly" -exec rm -rf '{}' ';'
+        # Delete all expired weekly directories
+        find $BACKUP_DIR -maxdepth 1 -mtime +$EXPIRED_DAYS -name "*-weekly" -exec rm -rf '{}' ';'
  
-	perform_backups "-weekly"
+        perform_backups "-weekly"
  
-	exit 0;
+        exit 0;
 fi
  
 # DAILY BACKUPS
-----------------------------------------------------------------------

Summary of changes:
 pg_backup.sh         | 12 +++++-----
 pg_backup_rotated.sh | 68 ++++++++++++++++++++++++++--------------------------
 2 files changed, 40 insertions(+), 40 deletions(-)


hooks/post-receive
-- 
postgresql_auto_backup_s3


More information about the Bps-public-commit mailing list