Skip to content

Commit

Permalink
Ensure log and backup have the same name, fixes laurent22/rsync-time-…
Browse files Browse the repository at this point in the history
  • Loading branch information
basnijholt committed May 11, 2023
1 parent 504edc7 commit 91546ef
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rsync_time_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,11 +643,12 @@ def start_backup(
log_dir: str,
mypid: int,
ssh: Optional[SSH],
now: str,
) -> str:
"""Start backup."""
log_file = os.path.join(
log_dir,
f"{now_str()}.log",
f"{now}.log",
)
if ssh is not None:
src_folder = f"{ssh.src_folder_prefix}{src_folder}"
Expand Down Expand Up @@ -712,7 +713,8 @@ def backup(

check_dest_is_backup_folder(dest_folder, ssh)

dest = os.path.join(dest_folder, now_str())
now = now_str()
dest = os.path.join(dest_folder, now)
_backups = sorted(find_backups(dest_folder, ssh), reverse=True)
previous_dest = _backups[0] if _backups else None
inprogress_file = os.path.join(dest_folder, "backup.inprogress")
Expand Down Expand Up @@ -767,6 +769,7 @@ def backup(
log_dir,
mypid,
ssh,
now,
)
retry = deal_with_no_space_left(
log_file,
Expand Down

0 comments on commit 91546ef

Please sign in to comment.