[Bps-public-commit] postgresql_auto_backup_s3 branch update-for-hostedrt-backups created. c0a21afa925f5b93e4d3a260b71bb0fb55360992

BPS Git Server git at git.bestpractical.com
Thu Mar 10 23:50:58 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 created
        at  c0a21afa925f5b93e4d3a260b71bb0fb55360992 (commit)

- Log -----------------------------------------------------------------
commit c0a21afa925f5b93e4d3a260b71bb0fb55360992
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Thu Mar 10 17:48:51 2022 -0600

    Fix comparison operators

diff --git a/pg_backup.sh b/pg_backup.sh
index f07b47a..3a511c2 100644
--- a/pg_backup.sh
+++ b/pg_backup.sh
@@ -4,7 +4,7 @@
 ####### LOAD CONFIG #######
 ###########################
  
-while [ $# -gt 0 ]; do
+while [ "$#" -gt "0" ]; do
         case $1 in
                 -c)
                         if [ -r "$2" ]; then
@@ -22,7 +22,7 @@ while [ $# -gt 0 ]; do
         esac
 done
  
-if [ $# = 0 ]; then
+if [ "$#" -eq "0" ]; then
         SCRIPT=`realpath $0`
         SCRIPTPATH=`dirname $SCRIPT`
         source $SCRIPTPATH/pg_backup.config
@@ -113,7 +113,7 @@ echo -e "--------------------------------------------\n"
  
 for DATABASE in `psql -h "$HOSTNAME" -U "$USERNAME" -At -c "$FULL_BACKUP_QUERY" postgres`
 do
-	if [ $ENABLE_PLAIN_BACKUPS = "yes" ]
+	if [ "$ENABLE_PLAIN_BACKUPS" == "yes" ]
 	then
 		echo "Plain backup of $DATABASE"
  
@@ -124,7 +124,7 @@ do
 		fi
 	fi
  
-	if [ $ENABLE_CUSTOM_BACKUPS = "yes" ]
+	if [ "$ENABLE_CUSTOM_BACKUPS" == "yes" ]
 	then
 		echo "Custom backup of $DATABASE"
  
diff --git a/pg_backup_rotated.sh b/pg_backup_rotated.sh
index 2ceed5e..88dd857 100644
--- a/pg_backup_rotated.sh
+++ b/pg_backup_rotated.sh
@@ -4,7 +4,7 @@
 ####### LOAD CONFIG #######
 ###########################
  
-while [ $# -gt 0 ]; do
+while [ "$#" -gt "0" ]; do
         case $1 in
                 -c)
                         CONFIG_FILE_PATH="$2"
@@ -117,7 +117,7 @@ function perform_backups()
  
 	for DATABASE in `psql -h "$HOSTNAME" -U "$USERNAME" -At -c "$FULL_BACKUP_QUERY" postgres`
 	do
-		if [ $ENABLE_PLAIN_BACKUPS = "yes" ]
+		if [ "$ENABLE_PLAIN_BACKUPS" == "yes" ]
 		then
 			echo "Plain backup of $DATABASE"
  			
@@ -128,7 +128,7 @@ function perform_backups()
 	        	fi
 		fi
  
-		if [ $ENABLE_CUSTOM_BACKUPS = "yes" ]
+		if [ "$ENABLE_CUSTOM_BACKUPS" == "yes" ]
 		then
 			echo "Custom backup of $DATABASE"
  			if ! pg_dump -Fc -h "$HOSTNAME" -U "$USERNAME" "$DATABASE" | gzip --stdout | s3cmd --reduced-redundancy put - $FINAL_BACKUP_DIR"$DATABASE".custom.in_progress --no-encrypt; then
@@ -147,7 +147,7 @@ function perform_backups()
  
 DAY_OF_MONTH=`date +%d`
  
-if [ $DAY_OF_MONTH -eq 1 ];
+if [ "$DAY_OF_MONTH" -eq "1" ];
 then
 	# Delete all expired monthly directories
 	find $BACKUP_DIR -maxdepth 1 -name "*-monthly" -exec rm -rf '{}' ';'
@@ -162,7 +162,7 @@ fi
 DAY_OF_WEEK=`date +%u` #1-7 (Monday-Sunday)
 EXPIRED_DAYS=`expr $((($WEEKS_TO_KEEP * 7) + 1))`
  
-if [ $DAY_OF_WEEK = $DAY_OF_WEEK_TO_KEEP ];
+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 '{}' ';'
commit 27943f8cd30bcd476c54d9c6d2db51440d471f2d
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Thu Mar 10 17:24:39 2022 -0600

    Fix config file path generation

diff --git a/pg_backup.sh b/pg_backup.sh
index 4092cd0..f07b47a 100644
--- a/pg_backup.sh
+++ b/pg_backup.sh
@@ -23,7 +23,8 @@ while [ $# -gt 0 ]; do
 done
  
 if [ $# = 0 ]; then
-        SCRIPTPATH=$(cd ${0%/*} && pwd -P)
+        SCRIPT=`realpath $0`
+        SCRIPTPATH=`dirname $SCRIPT`
         source $SCRIPTPATH/pg_backup.config
 fi;
  
diff --git a/pg_backup_rotated.sh b/pg_backup_rotated.sh
index 10e36d6..2ceed5e 100644
--- a/pg_backup_rotated.sh
+++ b/pg_backup_rotated.sh
@@ -18,7 +18,8 @@ while [ $# -gt 0 ]; do
 done
  
 if [ -z $CONFIG_FILE_PATH ] ; then
-        SCRIPTPATH=$(cd ${0%/*} && pwd -P)
+        SCRIPT=`realpath $0`
+        SCRIPTPATH=`dirname $SCRIPT`
         CONFIG_FILE_PATH="${SCRIPTPATH}/pg_backup.config"
 fi
  
-----------------------------------------------------------------------


hooks/post-receive
-- 
postgresql_auto_backup_s3


More information about the Bps-public-commit mailing list