fixed timing delete tmp functions when tmp folder is still in use

This commit is contained in:
Llewellyn van der Merwe 2018-07-06 00:04:44 +02:00
parent 000fff2528
commit 2a5660056a
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
1 changed files with 19 additions and 2 deletions

21
main.sh
View File

@ -19,14 +19,16 @@
#
#/-----------------------------------------------------------------------------------------------------------------------------/
#confirm we are done
BACKUPDBDONE=0
BACKUPWEBDONE=0
### MAIN ###
function main () {
# backup the databases now
backupDB &
# backup the websites now
backupWEB
# now remove the local file
rmTmpFolder "$tmpFolder"
}
# function to backup all DB's
@ -46,6 +48,10 @@ function backupDB () {
if [ "$BACKUPTYPE" -eq "1" ]; then
ssh -tt -p '22' "$REMOTESSH" "$(typeset -f); remoteHouseCleaning $REMOTEDBPATH"
fi
#confirm we are done
BACKUPDBDONE=1
# try to remove tmp
rmTmp
}
# function to backup all WEB folders
@ -65,6 +71,17 @@ function backupWEB () {
if [ "$BACKUPTYPE" -eq "1" ]; then
ssh -tt -p '22' "$REMOTESSH" "$(typeset -f); remoteHouseCleaning $REMOTEWEBPATH"
fi
#confirm we are done
BACKUPWEBDONE=1
# try to remove tmp
rmTmp
}
function rmTmp () {
if [ "$BACKUPWEBDONE" -eq "1" ] && [ "$BACKUPDBDONE" -eq "1" ]; then
# now remove the local file
rmTmpFolder "$tmpFolder"
fi
}
# run the main only at the end!