diff --git a/restic.sh b/restic.sh index 5653ab2..4948bc8 100644 --- a/restic.sh +++ b/restic.sh @@ -3,8 +3,17 @@ LOCKFILE="/tmp/restic.lock" LOGFILE="/var/log/restic/restic_$(date +%Y%m%d-%H%M%S).log" LATEST_RESTIC_VERSION="0.12.1" -RESTIC_REPOSITORY="sftp:root@gauntnas.home.johnhgaunt.com:50022:/mnt/restic" -RESTIC_PASSWORD="restic" +LOCAL_RESTIC_REPOSITORY="/mnt/data/backups/restic" +export RESTIC_REPOSITORY="sftp:root@gauntnas.home.johnhgaunt.com:50022:/mnt/restic" +export RESTIC_PASSWORD="restic" + +if [ -d ${LOCAL_RESTIC_REPOSITORY} ]; then + restic --repo ${LOCAL_RESTIC_REPOSITORY} snapshots + if [ ${?} == "0" ]; then + export RESTIC_REPOSITORY=${LOCAL_RESTIC_REPOSITORY} + fi +fi + # make log directory if [ ! -d $(dirname ${LOGFILE}) ]; then