# /opt/other/x=user@host/backup/x
SRCS=( $(grep ^/ $CONFIG) )
+
+# add --exlude option for any path of $SRCS that extends $1
+excludes() {
+ local SRC X
+ for SRC in "${SRCS[@]}" ; do
+ SRC=${SRC%%=*}
+ [ "$SRC" = "$1" ] && continue
+ [ -z "${SRC%$1*}" ] && echo -n " --exclude $SRC"
+ done
+}
+
for SRC in "${SRCS[@]}" ; do
if [ "${SRC#*=}" = "$SRC" ] ; then
DST=$TARGET$SRC
SRC="${SRC%%=*}"
fi
echo "** Backing up $SRC to $DST"
- dupltool ${OPTIONS[*]} $SRC pexpect+scp://$DST
+ echo dupltool $(excludes "$SRC") ${OPTIONS[*]} $SRC pexpect+scp://$DST
+ dupltool $(excludes "$SRC") ${OPTIONS[*]} $SRC pexpect+scp://$DST
done |& logger -t backup