I currently have a dedicated Ubuntu backup server which wakes itself up from suspend (using rtcwake) daily. 5 minutes later a cron BASH job kicks in, using rsync to pull files from various network locations. If this BASH script completes, the last thing it does is put the server back to sleep until the following day (5 minutes before the backup job starts running again - you get the picture!).
There is an additional cron job which runs at 10:45pm to 'clean up' any running script/rsync processes, and then suspend the machine until the next day.
My problem/query is: the machine is on a slow link (802.11n wireless) and has to sync some pretty big media files. I am using rsync commands similar to this:
rsync -aPvz -e ssh --itemize-changes --modify-window=60 --exclude 'thumbs.db' /source/ /destination/
And in the case where rsync can't complete within the time the server is awake, I assumed (because of -P) that it would try to pick up where it left off.
What actually seems to happen is that I end up with multiple partial copies of the same file in the directory, but the copy never completes.
.BigFile.mkv.EJtNSS (4.1GB) .BigFile.mkv.KSUStW (3.7GB) .BigFile.mkv.LSewSA (4.3GB)
Has anyone come across a similar scenario before? I'm very happy to change it all over if there's a piece of software that will do a similar job (including handling the sleep/wake). I'm new to BASH scripting, but up for trying any suggestions.