Skip to content

Commit

Permalink
Merge pull request #106 from stuartmaxwell:backup-script-tweak
Browse files Browse the repository at this point in the history
Use gzip in backups
  • Loading branch information
stuartmaxwell authored Oct 7, 2024
2 parents c2a92e2 + c9526bc commit 34bb9e5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -euf -o pipefail
DB_PATH="/app/$DB_NAME.sqlite3"
BACKUP_PATH="/app/backup"
BACKUP_FILE="${BACKUP_PATH}/backup-$(date +%H).sqlite3"
TAR_FILE="${BACKUP_PATH}/backup-$(date +%H).tar.zst"
TAR_FILE="${BACKUP_PATH}/backup-$(date +%H).tar.gz"

# Ensure the backup directory exists
mkdir -p "${BACKUP_PATH}"
Expand All @@ -16,7 +16,7 @@ mkdir -p "${BACKUP_PATH}"
sqlite3 "${DB_PATH}" "VACUUM INTO '${BACKUP_FILE}'"

# Compress the backup
tar --zstd -cf "${TAR_FILE}" "${BACKUP_FILE}"
tar --gzip -cf "${TAR_FILE}" "${BACKUP_FILE}"

# Upload to S3
aws s3 cp "${TAR_FILE}" s3://$S3_BUCKET/backup-$(date +%H).tar.zst
aws s3 cp "${TAR_FILE}" s3://$S3_BUCKET/backup-$(date +%H).tar.gz

0 comments on commit 34bb9e5

Please sign in to comment.