-
-
Save bdonvr/5d4e56dadcb29de656368a1cb78cc00e to your computer and use it in GitHub Desktop.
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 | |
# Remove old (local) backup | |
sudo rm /home/server/backups/pictrs/*.gz | |
# Set file name | |
FILE_NAME="pictrs_backup_`TZ='America/New_York' date +%Y-%m-%d_%H%M`.tar.gz" | |
# Backup, using 'nice' so it doesn't steal all the CPU from lemmy lmao | |
sudo nice -n 20 tar -czf /home/server/backups/pictrs/$FILE_NAME /srv/lemmy/thelemmy.club/volumes/pictrs | |
# Upload | |
rclone copy /home/server/backups/pictrs/$FILE_NAME b2crypt:pictrs |
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 | |
FILE_NAME="db_backup_`TZ='America/New_York' date +%Y-%m-%d_%H%M`.sql.gz" | |
# Delete 6th oldest (and older) backups | |
cd /home/server/backups/PSQL | |
ls -t | tail -n +5 | xargs -d '\n' -r rm | |
# Postgres dump into gzip file | |
docker exec thelemmyclub_postgres_1 pg_dumpall -c -U lemmy | gzip > /home/server/backups/PSQL/$FILE_NAME | |
# Upload to B2 | |
rclone copy /home/server/backups/PSQL/$FILE_NAME b2crypt:postgres-dumps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment