Skip to content

Commit

Permalink
Feat/s3 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
bboure authored Sep 24, 2020
1 parent 49c3d6c commit e50dae5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion backups.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ cd ${MYBACKUPDIR}

echo "Backup running to $MYBACKUPDIR" >> /var/log/cron.log

echo "Dump users and permisions" >> /var/log/cron.log
pg_dumpall --globals-only | aws s3 cp - s3://${S3_BUCKET}/${S3_BUCKET_PREFIX}/globals.dmp

#
# Loop through each pg database backing it up
#
#echo "Databases to backup: ${DBLIST}" >> /var/log/cron.log
for DB in ${DBLIST}
do
FILENAME=${MYBACKUPDIR}/${DUMPPREFIX}_${DB}.${MYDATE}.dmp
Expand Down
8 changes: 7 additions & 1 deletion start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,16 @@ export REMOVE_BEFORE=$REMOVE_BEFORE
export DBLIST=\"$DBLIST\"
export S3_BUCKET=\"$S3_BUCKET\"
export S3_BUCKET_PREFIX=\"$S3_BUCKET_PREFIX\"
" > /pgenv.sh

if [ "${AWS_ACCESS_KEY_ID}" ] && [ "$AWS_SECRET_ACCESS_KEY" ]; then
echo "
export AWS_ACCESS_KEY_ID=\"$AWS_ACCESS_KEY_ID\"
export AWS_SECRET_ACCESS_KEY=\"$AWS_SECRET_ACCESS_KEY\"
"
fi


" > /pgenv.sh
echo "Start script running with these environment options"
cat /pgenv.sh
set | grep PG
Expand Down

0 comments on commit e50dae5

Please sign in to comment.