summaryrefslogtreecommitdiff
path: root/borgAuto.sh
diff options
context:
space:
mode:
authorSt33v <github@f3rr3t.com>2022-12-29 13:07:45 +1100
committerSt33v <github@f3rr3t.com>2022-12-29 13:07:45 +1100
commitb641bda213cd65cfaf4ee2c2a7e21c53026b15ff (patch)
treea4f3d3984cc2ba30f01fc10d853718d3a4b33c6e /borgAuto.sh
parentedc13f33253715884caa0c732df3ed4f704923fb (diff)
mountpoint not working
Diffstat (limited to 'borgAuto.sh')
-rwxr-xr-xborgAuto.sh26
1 files 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}