Skip to content

Commit a53eeee

Browse files
committed
enh: create a tarball after backup
1 parent 5c1126d commit a53eeee

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

scripts/backup_mongodb.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ fi
4848
# Dump the database
4949
mongodump "${dump_opts[@]}"
5050

51+
# Create compressed tarball and remove dump directory
52+
tar -czf "${BACKUP_PATH}.tar.gz" -C "$BACKUP_DIR" "db_backup_${DATE}"
53+
rm -rf "$BACKUP_PATH"
54+
5155
# Stop mongod if we started it
5256
if [ "$started_mongod" = true ]; then
5357
echo "Stopping mongod..."

0 commit comments

Comments
 (0)