basnijholt/rsync-time-machine.py

Script execution error on destination folder containing the name of the script folder.

jesusguevarautomotriz opened this issue ยท 4 comments

Hi,
Context:
I do git clone https://github.com/basnijholt/rsync-time-machine.py.git >> I rename folder to rtmpy. Also rename the script to rtm.py.

There are several scripts similar to this that I'm testing, they all contain the term rsync in the name, so I shorten the name to its initial letters to differentiate between them and to be able to do separate searches of the bash history of any rsync-based scripts and of the program rsync.

But also at the end of the path of the destination folder I put the name of the folder that contains the script:
rtmpy: script folder.
backup/x/y/z/2023-07-17_rtmpy
So I can khow very quickly at a glance and without opening the directory with which script that backup was made.

I suspect that doing this results in an error.

The original directory that I intend to back up, containing the name rtmpy in its path.

user02@AsusVivoBookX712JA ~/rtmpy                      
$ ./rtm.py /cygdrive/c/Docs user04@asusx750jbku23:/media/user04/Expansion/Backups_Live/Personal/003-Laptop-AsusVivoBookX712JA-212_V17WN/2023-06-25_**rtmpy**/ rsync-append-flags="--dry-run"                                      
Traceback (most recent call last):                     
  File "/home/user02/rtmpy/./rtm.py", line 925, in <module>                                                    
    main()                 
  File "/home/user02/rtmpy/./rtm.py", line 907, in main                                                        
    backup(                
  File "/home/user02/rtmpy/./rtm.py", line 828, in backup                                                      
    handle_still_running_or_failed_or_interrupted_backup(                                                      
  File "/home/user02/rtmpy/./rtm.py", line 656, in handle_still_running_or_failed_or_interrupted_backup        
    exit_if_pid_running(running_pid, ssh)              
  File "/home/user02/rtmpy/./rtm.py", line 630, in exit_if_pid_running                                         
    if running_cmd.returncode == 0:                    
AttributeError: 'str' object has no attribute 'returncode'                                                     

user02@AsusVivoBookX712JA ~/rtmpy                      
$                          

Making the change (o delete) of one letter, I get the expected result.

user02@AsusVivoBookX712JA ~/rtmpy                      
$ ./rtm.py /cygdrive/c/Docs user04@asusx750jbku23:/media/user04/Expansion/Backups_Live/Personal/003-Laptop-AsusVivoBookX712JA-212_V17WN/2023-06-25_rtmp/ rsync-append-flags="--dry-run"                                       
rsync-time-machine.py: Safety check failed - the destination does not appear to be a backup folder or drive (marker file not found).      
rsync-time-machine.py: If it is indeed a backup folder, you may add the marker file by running the following command:                     
rsync-time-machine.py: ssh -p 22 user04@asusx750jbku23 'mkdir -p -- "/media/user04/Expansion/Backups_Live/Personal/003-Laptop-AsusVivoBookX712JA-212_V17WN/2023-06-25_rtmp" ; touch "/media/user04/Expansion/Backups_Live/Personal/003-Laptop-AsusVivoBookX712JA-212_V17WN/2023-06-25_rtmp/backup.marker"'                                   

user02@AsusVivoBookX712JA ~/rtmpy                      
$                          

Screenshot 2023-07-17 231541
Thank you.

I see the issue! Thanks for reporting. I fixed this issue in da048c2.

Unfortunately, I have no access to a Cygwin machine and there is no CI that is readily available where I can test it on.

Could you try again after updating?

You are also missing the -- in --rsync-append-flags BTW

After test:

rsync-time-machine.py: Backup completed without errors. 

It works. Thank you for all..!

Glad it now works! ๐Ÿ˜„