diff --git a/usr/local/sbin/restic_backup.sh b/usr/local/sbin/restic_backup.sh index d1acb4c..6def725 100644 --- a/usr/local/sbin/restic_backup.sh +++ b/usr/local/sbin/restic_backup.sh @@ -22,8 +22,17 @@ RETENTION_MONTHS=18 RETENTION_YEARS=3 # What to backup, and what to not -BACKUP_PATHS="/ /boot /home /mnt/media" -BACKUP_EXCLUDES="--exclude-file /.backup_exclude --exclude-file /mnt/media/.backup_exclude --exclude-file /home/erikw/.backup_exclude" +BACKUP_PATHS="/ /boot /home" +[ -d /mnt/media ] && BACKUP_PATHS+=" /mnt/media" +BACKUP_EXCLUDES="--exclude-file /.backup_exclude" +for dir in /home/* +do + if [ -f "$dir/.backup_exclude" ] + then + BACKUP_EXCLUDES+=" --exclude-file $dir/.backup_exclude" + fi +done + BACKUP_TAG=systemd.timer