Dany Lavrov Dany Lavrov - 1 month ago 17
Linux Question

enable rsync to run permanently

I have two machines, both running on linux with centos 7.
I have installed the rsync packages on both of them and i am able to sync a directory from one machine to the other.

Right now i am doing the syncing manually, each time i want to sync i am running the next line:

rsync -r /home/stuff root@123.0.0.99/home


I was wondering if there is a way of configuring the rsync to do the syncing automatically, every some amount of time or preferably when there is a new file of sub directory in the home directory?

Thank you for your help.
Any help would be appreciated.

Answer

If you want to rsync every some amount of time you can use cronjobs which can be configured to run a specific command each amount of time and if you want to run rsync when there is an update or modification you can use lsyncd. check this article about use lsyncd

Comments