Created
December 11, 2018 11:44
-
-
Save NanneHuiges/e22039fae3568185d3ef43b8c1069303 to your computer and use it in GitHub Desktop.
firefly-iii backup script
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 | |
# | |
# author: Nanne Huiges ([email protected]) | |
# verbose: shows commands for debugging | |
set -x | |
INSTALL_DIR="/home/pi/firefly" | |
BACKUP_DIR="/home/pi/backups" | |
COMPOSE="/usr/local/bin/docker-compose" | |
NOW=$(date +"%Y_%m_%d") | |
mkdir -p $BACKUP_DIR/$NOW | |
# working directory | |
cd $INSTALL_DIR | |
# take the system down. We can't copy databasefiles on a running system | |
$COMPOSE down | |
# copy / tar. split in 3 separate commands for easier debugging. | |
$COMPOSE run -v $BACKUP_DIR/$NOW:/backups backup \ | |
tar czvf /backups/backup_db.tar.gz /var/lib/postgresql/data | |
$COMPOSE run -v $BACKUP_DIR/$NOW:/backups backup \ | |
tar czvf /backups/backup_export.tar.gz /var/www/firefly-iii/storage/export | |
$COMPOSE run -v $BACKUP_DIR/$NOW:/backups backup \ | |
tar czvf /backups/backup_upload.tar.gz /var/www/firefly-iii/storage/upload | |
# copy some stray files. the docker-compose is important as it holds your env. settings! | |
# for instance your FF_APP_KEY | |
cp $INSTALL_DIR/Dockerfile $BACKUP_DIR/$NOW | |
cp $INSTALL_DIR/docker-compose.yml $BACKUP_DIR/$NOW | |
cp -r $INSTALL_DIR/bin $BACKUP_DIR/$NOW | |
$COMPOSE up -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment