1
0
mirror of https://github.com/Llewellynvdm/Backup-System.git synced 2024-12-12 17:07:46 +00:00

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

21
main.sh
View File

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