From b641bda213cd65cfaf4ee2c2a7e21c53026b15ff Mon Sep 17 00:00:00 2001 From: St33v Date: Thu, 29 Dec 2022 13:07:45 +1100 Subject: mountpoint not working --- borgAuto.sh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/borgAuto.sh b/borgAuto.sh index e594fd6..d8e8dff 100755 --- a/borgAuto.sh +++ b/borgAuto.sh @@ -2,12 +2,31 @@ # 8 Sept 2019 SJ Pratt # Copied from https://blog.andrewkeech.com/posts/170718_borg.html # the envvar $REPONAME is something you should just hardcode - export BORG_REPO="/mnt/bak/borg" # (now set in ~/.bashrc) +# export BORG_REPO="/mnt/bak/borg" # (now set in ~/.bashrc) + +# Route logging to journalctl +2>&1 MAXFILES=20 #Max number of file changes to log +MOUNTPOINT=/mnt/bak + +# noauto = don't mount backup disk at boot +# user = allow user to mount the disk +# line from /etc/fstab: +# UUID=XXXX /mnt/bak btrfs defaults,noauto,user 0 0 + +# Try to mount the backup disk +mountpoint -q ${MOUNTPOINT} +if [ $? -eq 1 ]; then + echo "Mounting backup disk to ${MOUNTPOINT}." + mount -v ${MOUNTPOINT} +fi + +if [ $? -ne 0 ]; then + echo "Failed to mount backup disk -- exiting" + exit 1 +fi -# Route the normal process logging to journalctl -2>&1 # DIFF function # List changes between this archive and the previous one @@ -125,6 +144,7 @@ else exitmsg="Backup ($backup_exit) and/or Prune ($prune_exit) finished with errors" fi +umount -v ${MOUNTPOINT} echo "${exitmsg}" notify "${exitmsg}" exit ${global_exit} -- cgit v1.3