laurent22 / rsync-time-backup

Time Machine style backup with rsync.
3.38k stars 446 forks source link

inprogress not set while purging old backups #188

Open SimonHeimberg opened 4 years ago

SimonHeimberg commented 4 years ago

The "inprogress" mark is set after purging old backups. Problem: When deleting old backups takes long (many backups to purge, slow fs because remote mount, ...), a new backup can start successfully while the 1st is still purging backups.

suggestion: create "inprogress" just after checking if it exists. This may have side effect on trying to resume an aborted backup. to improve this, the backup could get a temporary name ("_" preppended?) and be renamed to the final name when finished.

see in code:

  1. check if inprogress exists: $(fn_find "$INPROGRESS_FILE") ... , L450
    1. expire backups: fn_expire_backups ..., L529
    2. create inprogress file: echo $MYPID > $INPROGRESS_FILE , L566

note: also order related: defining link dest before purging backups #162 side note: DEST="$DEST_FOLDER/$NOW" is already done before purging, so the stamp in the folder name may have almost noting to do with the time of its content.