#!/bin/bash # # Backup directories daily. Configuration at /etc/duplicity-daily # Requires dupltool [ -x /usr/bin/dupltool ] || exit 0 CONFIG=/etc/duplicity-daily.conf grep -q ^ENABLE=yes $CONFIG || exit 0 # Detail backup options OPTIONS=( $(grep ^OPTIONS= $CONFIG | sed 's/^OPTIONS=//') ) # The default backup target TARGET="$(grep ^TARGET= -m1 $CONFIG | sed 's/^TARGET=//')" # Backup lines start with full path, optionally with =target # No spaces in pathname or target, e.g. # /home # /opt/other/x=user@host/backup/x SRCS=( $(grep ^/ $CONFIG) ) for SRC in "${SRCS[@]}" ; do if [ "${SRC#*=}" = "$SRC" ] ; then DST=$TARGET$SRC else DST="${SRC##*=}" SRC="${SRC%%=*}" fi echo "** Backing up $SRC to $DST" dupltool ${OPTIONS[*]} $SRC pexpect+scp://$DST done |& logger -t backup