Added immich backup script and mounting script

This commit is contained in:
FrederikBaerentsen 2024-06-01 18:01:29 +02:00
parent 265202c15d
commit 94b893530d
3 changed files with 45 additions and 0 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
account
bucket

32
backup.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/bash
source ./account
source ./bucket
FOLDER="/home/drudoo/Pi2/immich"
EXCLUDE='lost+found'
if pidof -x restic > /dev/null; then
echo "Restic backup is already running"
exit
else
echo "Starting backup: $FOLDER to $RESTIC_BUCKET"
fi
if mount | grep /home/drudoo/Pi2 > /dev/null; then
echo "Mount exists"
else
exit
fi
restic -v -r b2:$RESTIC_BUCKET backup $FOLDER -o b2.connections=50
day=$(date +"%u")
if [[ day -eq 5 ]]; then
echo "Deleting old backups"
restic -r b2:$RESTIC_BUCKET forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --keep-yearly 2 --prune
restic -r b2:$RESTIC_BUCKET check
fi

12
mountBackblaze.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
source ./account
source ./bucket
FOLDER='restic_mount'
# EDIT ABOVE
echo 'Mounting '$RESTIC_BUCKET
restic mount -r b2:$RESTIC_BUCKET /home/drudoo/$FOLDER