Skip to content

Commit cbb237c

Browse files
authored
Merge pull request #6 from siameseoriental/Add_separate_directories
Add separate directory to each type of backup
2 parents 7f0319e + f62406e commit cbb237c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

backup.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ fi
1717

1818
export PGPASSWORD=${POSTGRES_PASSWORD}
1919

20+
mkdir --parents $backup_path
21+
cd $backup_path
22+
23+
echo "Starting $1 backup in $(pwd)"
24+
2025
# Will create base backup
2126
echo "Backing up [${POSTGRES_USER}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}] to\
2227
[${S3_ENDPOINT}], extra opts - [${POSTGRES_EXTRA_OPTS}]."
@@ -64,7 +69,8 @@ mcli cp "${ARCHIVE_FILE_NAME}" "${S3_ALIAS}"/"${relative_s3_object_path}"
6469

6570
# Do clean up
6671
echo "Maid is here... Doing cleaning..."
67-
rm --force "${POSTGRES_DB}".*
72+
cd ..
73+
rm --recursive --force $backup_path
6874

6975
# Do announce
7076
# We are not going to spam chat every hour. Excluded hourly backups from notifications

0 commit comments

Comments
 (0)