First I thought that rsync
isn't syncing everything described here Limitations of rsync? Not syncing everything
Now after a day I found out that it was actually still working/ running and now all the files are there. The problem is: My zip is instead of 1gb only 200mb.
Because the zip was created I thought rsync
is "finished" and just doesn't download everything. My logic was: tar only gets executed when rsync
is finished. But as it seems that is not the case.
How can I make tar
wait until rsync is completely finished? So I don't end up with archive that's not complete?
This is my code:
USER="myusername"
SERVER="myserverip"
PORT="22"
SOURCE="shop"
TARGET="/volume1/BACKUPS/MyFolder/MySubfolder/data/"
LOG="/volume1/BACKUPS/MyFolder/MySubfolder/backup_data.log"
mkdir /volume1/BACKUPS/MyFolder/MySubfolder/
rsync -avz --progress -e "ssh -p $PORT" $USER@$SERVER:$SOURCE $TARGET --delete >> $LOG 2>&1
tar -zcvf /volume1/BACKUPS/MyFolder/archivename-$(date +%Y-%m-%d_%H_%M_%S).tar.gz -C /volume1/BACKUPS/MyFolder/MySubfolder/ .
This is maybe a second question, but somehow related to "only do something when the first thing is finished". How can I detect that the archive is also "finished"? So I don't end up opening/ unpacking an archive that still getting processed? Something like rename the file after the archiving is actually finished. How can I make sure that this renaming doesn't just start at some time and wait until the line before is actually ready, like with rsync
?