From ea133c823ffe4ebfe523318b4672fde1b5866d3d Mon Sep 17 00:00:00 2001 From: Todd E Johnson Date: Fri, 12 Jul 2019 23:16:58 -0500 Subject: [PATCH] Fix missing directories on install --- usr/local/sbin/restic_backup.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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