Created
May 15, 2022 15:09
-
-
Save garenyondem/8679cdfcca026c01a3a6f600cbc9b329 to your computer and use it in GitHub Desktop.
Cron-based sqlite backup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
# Ensure script stops when commands fail. | |
set -e | |
# Backup & compress our database to the temp directory. | |
sqlite3 /path/to/db '.backup /tmp/db' | |
gzip /tmp/db | |
# Upload backup to S3 using a rolling daily naming scheme. | |
aws s3 cp /tmp/db.gz s3://mybucket/db-`date +%d`.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment