Skip to content

Instantly share code, notes, and snippets.

@optimistic5
Created February 28, 2020 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save optimistic5/d57a9632791dcea87d36343935d2593e to your computer and use it in GitHub Desktop.
Save optimistic5/d57a9632791dcea87d36343935d2593e to your computer and use it in GitHub Desktop.
Backup Firefly-III database script
#!/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