laurent22 / rsync-time-backup

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

Support for several rsync-time-backup jobs run at the very same moment with same log-dir #192

Open ajutzeler opened 4 years ago

ajutzeler commented 4 years ago

If two jobs are run at the same time with default options, the longer one will crash because of conflicting log files.

Indeed, as the two jobs will log in the same file, the first job to finish will remove it at cleanup and the second will not find the file anymore resulting in a crash.

This can of course already be solved using different --log-dir values but we could make it a bit more robust and allow several concurrent jobs with the default log-dir value by prefixing the log file with a small random string (using /dev/urandom for instance).

The offending line:

539: LOG_FILE="$LOG_DIR/$(date +"%Y-%m-%d-%H%M%S").log"