Fixing bug where nfs/usmb shares were never mounted

This commit is contained in:
Rob Pearce 2019-03-22 18:42:20 +11:00
parent b09a7b16cc
commit f3ea526fc9
1 changed files with 16 additions and 4 deletions

20
bare.sh
View File

@ -292,6 +292,14 @@ for f in $REPOSTOBACKUP; do
log "can't find matching repo for $f - make sure it is listed in ${REPOFILE}" log "can't find matching repo for $f - make sure it is listed in ${REPOFILE}"
exit 1 exit 1
fi fi
if [[ $CMD == "go" ]]; then
NEEDMOUNT=1
elif [[ $CMD == "diff" ]]; then
NEEDMOUNT=1
else
NEEDMOUNT=0
fi
if [[ $NEEDMOUNT -eq 1 ]]; then if [[ $NEEDMOUNT -eq 1 ]]; then
if [[ $USEUSMB -eq 1 ]]; then if [[ $USEUSMB -eq 1 ]]; then
@ -362,8 +370,8 @@ for f in $REPOSTOBACKUP; do
getmode "$f" getmode "$f"
if [[ $mode == "restic" ]]; then if [[ $mode == "restic" ]]; then
MYREPO="restic: $RESTIC_REPOSITORY"
if [[ -z $KSPEED ]]; then if [[ -z $KSPEED ]]; then
SPEEDOPTS="" SPEEDOPTS=""
else else
@ -378,6 +386,8 @@ for f in $REPOSTOBACKUP; do
AUTHOPTS="-p ${AUTHFILE}" AUTHOPTS="-p ${AUTHFILE}"
elif [[ $mode == "rsync" ]]; then elif [[ $mode == "rsync" ]]; then
# rsync
MYREPO="rsync: ${RSYNC_USER}@${RSYNC_SERVER}:${RSYNC_FULLDIR}"
for f in RSYNC_SERVER RSYNC_USER RSYNC_DIR RSYNC_OPTIONS ]]; do for f in RSYNC_SERVER RSYNC_USER RSYNC_DIR RSYNC_OPTIONS ]]; do
eval val='$'$f eval val='$'$f
if [[ -z $val ]]; then if [[ -z $val ]]; then
@ -388,7 +398,6 @@ for f in $REPOSTOBACKUP; do
fi fi
done done
# rsync
if [[ -z $KSPEED ]]; then if [[ -z $KSPEED ]]; then
SPEEDOPTS="" SPEEDOPTS=""
else else
@ -397,6 +406,7 @@ for f in $REPOSTOBACKUP; do
CONNECTIONSOPTS="" CONNECTIONSOPTS=""
else else
# rclone # rclone
MYREPO="rclone: $RCLONE_REPOSITORY"
if [[ -z $KSPEED ]]; then if [[ -z $KSPEED ]]; then
SPEEDOPTS="" SPEEDOPTS=""
else else
@ -410,8 +420,9 @@ for f in $REPOSTOBACKUP; do
fi fi
fi fi
log "Starting '$CMD' on repo '$REPO' [$DATAPATH]"
text="Starting '$CMD' on repo '$REPO' [$DATAPATH <-> $MYREPO]"
log "$text"
if [[ $mode == "restic" ]]; then if [[ $mode == "restic" ]]; then
if [[ $CMD == "go" ]]; then if [[ $CMD == "go" ]]; then
@ -449,6 +460,7 @@ for f in $REPOSTOBACKUP; do
ssh ${RSYNC_USER}@${RSYNC_SERVER} ls ${RSYNC_FULLDIR} 2>&1 >> ${LOG} ssh ${RSYNC_USER}@${RSYNC_SERVER} ls ${RSYNC_FULLDIR} 2>&1 >> ${LOG}
rv=$? rv=$?
elif [[ $CMD == "stats" ]]; then elif [[ $CMD == "stats" ]]; then
echo "Size of remote data for ${REPO}:"
ssh ${RSYNC_USER}@${RSYNC_SERVER} du -hs ${RSYNC_FULLDIR} 2>&1 >> ${LOG} ssh ${RSYNC_USER}@${RSYNC_SERVER} du -hs ${RSYNC_FULLDIR} 2>&1 >> ${LOG}
rv=$? rv=$?
elif [[ $CMD == "diff" ]]; then elif [[ $CMD == "diff" ]]; then