I own few machines. One of them is my main – everyday machine, others are my backup machines that I use when the main machine is doing something heavy or when I cannot access it for another reason. Sometimes it’s annoying. Really annoying. Why? Oh for example the pidgin config files are not synchronized between the machines. I added some contacts to the main machine pidgin configuration and I never had a chance to set them up on the rest of my machines. I had a chat or two with a friend and the logs are not available on my other machines so I cannot check the history of the chat. I changed the configuration of the Firefox on my main machine and the other machines are still not updated… Same goes to Thunderbird / e-mail settings and synchronization… Even my folders with data… It was seriously bothering me so… I have found a perfect solution.
Assuming that You have read my previous posts about SSH:
You may want to have a look at this one as well… Synchronizing files between the machines via SSH using rsync…
It’s extremely simple. Assuming that You have passwordless authentication working all You need is one command. Command should be ran on the ssh client machine. In other words You should run it on the machine You want to synchronize files to. It will connect to the remote SSH server machine and download the files from it.
rsync -avz -e ssh firstname.lastname@example.org:/home/andrzejl/.purple /home/andrzejl/
This command will connect with login
andrzejl to the SSH server running on the
192.168.0.100 machine and it will incrementally synchronize the
/home/andrzejl/.purple folder to the
/home/andrzejl/ folder on a local machine. I didn’t add the
.purple folder at the end of the command as the synchronization process will create it if it’s not there. If I would add it – it would create
Now imagine possibilities… Put that command in a script and then create automatized job in crontab so it will be executed every let’s say 1 hour (I did it here – works perfect!)… Your client (backup / spare) machine config files will always be synchronized with Your main – server machine. Your data folders can be synchronized between all Your machines… Perfect… That’s what I wanted…
Hope it helps somebody someday.
Edit 01: OH BOY! Is this faster then copying the files with midnight commander… When syncing my pidgin folder to a fresh install and using mc it could take up to 3 hours due to a fact that the logs folder has almost 60 megs and it contains over 41 000 small files… Rsync does it in less then 20 minutes… and later it just copies the “new” files thanks to the “increment” option so it takes several seconds… Rsync rocks…
If that’s not cool… I don’t know what is…
Edit 02: If You have followed my Tightening security for SSH Server… topic and You have changed the SSH port You will have to slightly modify the command to add the port number.
Here is how it looks like:
rsync -avz -e 'ssh -p 20202' email@example.com:/home/andrzejl/.purple /home/andrzejl/