Re: [opensuse] Can I do this with rsync? (scripts)
Bob, Your reply just made me notice that I replied to you directly, instead of to the mailing-list. So, I resent my message for the benefit of the others. On Wed October 24 2007 20:06, Robert Smits wrote:
What does the first line with "#!/bin/bash" do? I understand it's a descriptive comment, but what does the !/bin/bash do for you.
It is not a comment. While # starts comments anywhere else in a bash script, if the script starts with "#!/bin/bash", bash will be used to interpret the script, even if someone's login shell is csh or tcsh. For example, if I had used the Bourne shell syntax, I should start my script with #!/bin/sh.
Second, I've been using rsync in the form rsync -a source file location destination file location. Is it because you want to do this interactively that you've added all these other options?
The fundamental difference is that both ends are active. If I was just mirroring my home to a passive backup destination, then a pure --archive option would suffice and I would probably do it on my entire $HOME. But in my case, I synchronize only key directory trees between the 3 machines and any of the 3 can have a more recent version of a document. --compress: speeds up synchronization between office and home. --update: prevents overwriting a newer version on the destination, if I forgot to update it in the source first. Say I change Projects/ABC/file1 in the office and forget I changed it. Then I work on Projects/ABC/file2 at home. If I didn't use update, I would revert to the old version of file1 when I archive Projects/ to the office. --partial --delay-updates: keep partial transfers if the connection breaks, so a restart only transfers the rest. The problem is the time of a partial file is always newer, since the time stamp is adjusted at the end. So, at restart a partial file would not only look complete, but also more recent, and when I synchronize back, I would corrupt the source, hence delay-updates. --progress: just to see that the connection is not hanging in case of large files.
I found that sometimes I forgot that I created a new file in the office, say under Projects/ABC/, and when I work from home and I want to "syncsend Projects", it asks if I want to delete that new file. I then say "no" and subsequently run "syncget Projects" to bring that file to my desktop at home.
But if i use the rsync command without the --delete parameter it won't delete any files at all on the receiving side, right? And if I have an extra one in either receiving or sending side, it'll add it, right?
Your synchronization is always one way, never back and forth at once. Without --delete, rsync will notice that there is an extra file at the destination, which would normally mean you deleted the corresponding file in the source, but rsync will not synchronize this deletion. rsync cannot know that in my case the destination side is not a pure backup site and that it can also generate new content. I have to run "rsync office home", which is "syncget" in this case, for rsync to bring the new file to my home machine.
Well.my scripts were much more primitive and I'll study yours to see how they add functionality. Once I have the scripts working I just want to run them daily with cron.
These are just different scenarios. I would use a cron job to sync to a true, passive backup site. Since all my sites are active and I am somewhat absent-minded, my initially simple interactive script evolved to this. :) -- Carlos FL Who is General Failure, and why is he reading my disk? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thu October 25 2007 06:42, Carlos F Lange wrote:
But if i use the rsync command without the --delete parameter it won't delete any files at all on the receiving side, right? And if I have an extra one in either receiving or sending side, it'll add it, right?
Your synchronization is always one way, never back and forth at once. Without --delete, rsync will notice that there is an extra file at the destination, which would normally mean you deleted the corresponding file in the source, but rsync will not synchronize this deletion. rsync cannot know that in my case the destination side is not a pure backup site and that it can also generate new content. I have to run "rsync office home", which is "syncget" in this case, for rsync to bring the new file to my home machine.
Hi, again, I just heard the episode on audio tools from Linux Reality podcast and at the end Chess gives a hint that might just help both of us. He mentioned "unison", which is supposedly a tool for two-way configuration. It is available in 10.3 and I just installed it. I will have to explore it more, but it looks like exactly what we want: "Unison is a file-synchronization tool for Unix and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other." (from their website) -- Carlos FL Who is General Failure, and why is he reading my disk? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Sun October 28 2007 19:10, Carlos F Lange wrote:
I will have to explore it more, but it looks like exactly what we want: "Unison is a file-synchronization tool for Unix and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other." (from their website)
Just in case someone is following this thread. I tried Unison, but I gave up before I got it to work. If you make one small typo, you have to start typing everything over again. You can't edit a synchronization profile. After trying 1/2 a dozen times from scratch, I gave up. But I found Grsync, which does all that my scripts do, but in a GUI. You have all the options in the GUI, nice pop-ups that tell what rsync option they correspond to (so you can read more about it in the rsync manual) and you can easily swap the synchronization directions. You can also test-drive your set of options (Simulation), as you should. -- Carlos FL Who is General Failure, and why is he reading my disk? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (1)
-
Carlos F Lange