From c984905550fb195957459cba7687242a9e76cac7 Mon Sep 17 00:00:00 2001 From: Martin Winkler Date: Thu, 13 Aug 2020 16:58:22 +0200 Subject: [PATCH] Add additional checks for correct mounting and tagert being writeable --- seqs/backup.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/seqs/backup.sh b/seqs/backup.sh index f331e6e..149d968 100755 --- a/seqs/backup.sh +++ b/seqs/backup.sh @@ -89,7 +89,7 @@ step_3() { fi if [ -z "$1" ] ; then - echoerr " [E] Noting found to backup $1" + echoerr " [E] Nothing found to backup $1" exit 1 fi @@ -137,7 +137,15 @@ step_3() { tmpTarget="${buTarget}/" fi + # remount target to be writable exep "mount -o rw,remount '${buTarget}' >>/dev/null 2>&1" + endReturn -o $? "Remount (${buTarget}) to be writable failed" + + if [ ! -w "${buTarget}" ] ; then + echoerr " [E] Backup target (${buTarget}) is not writable" + exit 1 + fi + exep "mv -f ${buTarget}/${buLog}0.log /tmp/${buLog}1.log 2>/dev/null" exep "rsync -avxHAX --delete --info=stats2 ${buExcludes[*]} ${tmpSource} ${tmpTarget} > /tmp/${buLog}0.log"