laurent22 / rsync-time-backup

Time Machine style backup with rsync.
3.4k stars 448 forks source link

Starting backup initially has high latency in a directory with many backups. #186

Open cr1901 opened 4 years ago

cr1901 commented 4 years ago

When doing a weekly/monthly backup with rsync_tmbackup.sh in a directory that contains approximately 30 backups, I've noticed that it can take upwards of 10 minutes before the backup actually begins with little to no information written to the console.

After enabling +x for the bash script and removing some redirection, I think I traced the problem to this line (trace upon request): https://github.com/laurent22/rsync-time-backup/blob/master/rsync_tmbackup.sh#L518, which is:

fn_find "$DEST -type d" 2>/dev/null`

Should the command on 518 in fact have a -maxdepth parameter? e.g.

fn_find "$DEST -maxdepth 1 -type d" 2>/dev/null

Right now the default behavior is to recursively look into each backup folder in the backup directory to look for whether the directory we want to create for the backup exists. Is there any particular reason to do this when the directory will be created aside any of the directories traversed by this command?