Created
February 28, 2020 19:01
-
-
Save optimistic5/d57a9632791dcea87d36343935d2593e to your computer and use it in GitHub Desktop.
Backup Firefly-III database script
This file contains hidden or 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 | |
############README | |
#chmod this script first | |
#chmod +x create_backup.sh | |
#Add this script to cron | |
#crontab -e | |
#0 0 * * * bash ~/firefly-iii/create_backup.sh | |
############ | |
#Leave only 5 last backups | |
ls -1 ~/firefly-iii/db-backup/backup_* | sort -r | tail -n +6 | xargs rm > /dev/null 2>&1 | |
#Create dump of database | |
docker exec firefly-iii_firefly_iii_db_1 pg_dump -c -h localhost -U firefly homestead > ~/firefly-iii/db-backup/backup_$(date +"%m-%d-%y").sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment