From e6002bfbdec13499e6ba8b2f1f5057d36d9bdfbc Mon Sep 17 00:00:00 2001 From: St33v Date: Thu, 29 Dec 2022 13:21:34 +1100 Subject: correctly checks and mounts backup disk --- borgAuto.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/borgAuto.sh b/borgAuto.sh index d8e8dff..134b0b8 100755 --- a/borgAuto.sh +++ b/borgAuto.sh @@ -17,15 +17,18 @@ MOUNTPOINT=/mnt/bak # Try to mount the backup disk mountpoint -q ${MOUNTPOINT} -if [ $? -eq 1 ]; then +mpExit=$? +if [ $mpExit -eq 32 ]; then echo "Mounting backup disk to ${MOUNTPOINT}." mount -v ${MOUNTPOINT} + mountpoint -q ${MOUNTPOINT} + mpExit=$? + if [ $mpExit -ne 0 ] ; then + echo "Failed to mount backup disk (mountpoint returned $mpExit)-- exiting" + exit 1 + fi fi -if [ $? -ne 0 ]; then - echo "Failed to mount backup disk -- exiting" - exit 1 -fi # DIFF function -- cgit v1.3