only mount/umount local points if required.
This commit is contained in:
parent
a7f9095f3c
commit
da46e88982
66
bare.sh
66
bare.sh
|
@ -293,28 +293,30 @@ for f in $REPOSTOBACKUP; do
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $USEUSMB -eq 1 ]]; then
|
||||
mount | grep -q ${DATAPATH}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
# try mounting it.
|
||||
${USMB} ${USMBNAME} >/dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
log "Mount usmb volume '$USMBNAME': success"
|
||||
else
|
||||
log "Mount usmb volume '$USMBNAME': FAILED"
|
||||
exit 1
|
||||
if [[ $NEEDMOUNT -eq 1 ]]; then
|
||||
if [[ $USEUSMB -eq 1 ]]; then
|
||||
mount | grep -q ${DATAPATH}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
# try mounting it.
|
||||
${USMB} ${USMBNAME} >/dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
log "Mount usmb volume '$USMBNAME': success"
|
||||
else
|
||||
log "Mount usmb volume '$USMBNAME': FAILED"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
elif [[ $USENFS -eq 1 ]]; then
|
||||
mount | grep -q ${DATAPATH}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
# try mounting it.
|
||||
mount -t nfs ${NFSPATH} ${DATAPATH} >/dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
log "Mount nfs volume '$NFSPATH' to $DATAPATH: success"
|
||||
else
|
||||
log "Mount nfs volume '$NFSPATH' to $DATAPATH: FAILED"
|
||||
exit 1
|
||||
elif [[ $USENFS -eq 1 ]]; then
|
||||
mount | grep -q ${DATAPATH}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
# try mounting it.
|
||||
mount -t nfs ${NFSPATH} ${DATAPATH} >/dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
log "Mount nfs volume '$NFSPATH' to $DATAPATH: success"
|
||||
else
|
||||
log "Mount nfs volume '$NFSPATH' to $DATAPATH: FAILED"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -349,6 +351,14 @@ for f in $REPOSTOBACKUP; do
|
|||
export RSYNC_FULLDIR="${RSYNC_DIR}/${REPO}"
|
||||
export RSYNC_REPOSITORY="${RSYNC_USER}@${RSYNC_SERVER}:${RSYNC_FULLDIR}"
|
||||
|
||||
if [[ $CMD == "go" ]]; then
|
||||
NEEDMOUNT=1
|
||||
elif [[ $CMD == "diff" ]]; then
|
||||
NEEDMOUNT=1
|
||||
else
|
||||
NEEDMOUNT=0
|
||||
fi
|
||||
|
||||
|
||||
getmode "$f"
|
||||
|
||||
|
@ -512,12 +522,14 @@ for f in $REPOSTOBACKUP; do
|
|||
fi
|
||||
|
||||
if [[ $rv -eq 0 ]]; then
|
||||
if [[ $USEUSMB -eq 1 ]]; then
|
||||
log "Unmounting usmb volume '$USMBNAME'"
|
||||
usmb -u $USMBNAME
|
||||
elif [[ $USENFS -eq 1 ]]; then
|
||||
log "Unmounting nfs volume '$NFSPATH' from $DATAPATH"
|
||||
umount $DATAPATH
|
||||
if [[ $NEEDMOUNT -eq 1 ]]; then
|
||||
if [[ $USEUSMB -eq 1 ]]; then
|
||||
log "Unmounting usmb volume '$USMBNAME'"
|
||||
usmb -u $USMBNAME
|
||||
elif [[ $USENFS -eq 1 ]]; then
|
||||
log "Unmounting nfs volume '$NFSPATH' from $DATAPATH"
|
||||
umount $DATAPATH
|
||||
fi
|
||||
fi
|
||||
else
|
||||
log "Error: '$CMD' on repo '$REPO' failed"
|
||||
|
|
Loading…
Reference in New Issue