-
-
Save gaurishhs/1f95c9b6ecaa4d775ed31385c8007d08 to your computer and use it in GitHub Desktop.
Backup 2 PostgreSQL services zip and upload via rclone deleting older files
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
#1/bin/bash | |
timestamp=$(date +"%H-%M-%S_%d-%m-%Y") | |
docker exec postgres pg_dump -U gaurish kanboard > ~/dumps/kanboard_dump-$timestamp.sql | |
docker exec davical-postgres pg_dumpall -U gaurish > ~/dumps/davical_dump-$timestamp.sql | |
cd dumps | |
zip -6 -r backup_$timestamp.zip kanboard_dump-$timestamp.sql davical_dump-$timestamp.sql | |
rclone copy backup_$timestamp.zip crypt:pg | |
rclone delete crypt:pg --min-age 4d | |
rm kanboard_dump-$timestamp.sql davical_dump-$timestamp.sql backup_$timestamp.zip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment