Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to sync two Linux servers in remote locations. To do so, I've decided to use rsync.

I've set the rsync to run on the target as a daemon, and the actual syncing command is ran from the source. I wanted to ask if this is the right setup for rsync (target daemon,source command). How should I run the sync command - using crontab or xinet or should I use some sort of file listener that will sync only after file change?

share|improve this question
up vote -1 down vote accepted

That arrangement is perfectly fine but we have no way of knowing whether or not anything you ask about is the best solution for your situation. How should you run the command? However you determine best suits your needs.

share|improve this answer
Thanks for your answer, I'm not an IT guy, I work in a small company so as a part of my job i have to set up rsync from our production to our DRP site. i read a lot about rsync, but didn't know for sure if i got it right, so i wanted to get advises from professional IT guys. My main dilemma is whether to run the rsync from the crontab/xinet or by file-listener. I'm asking cause I don't really know the ups and downs of each method. – Kuf Aug 13 '12 at 12:53
@Kuf, it depends as much as anything on just why you're using rsync n the first place. For the vast majority of cases a cron job is perfectly fine. – John Gardeniers Aug 13 '12 at 14:49

In your plan there is small issue. If some get access to your source server then he will be able to destroy all your data in source and target because he could run script for synchronization after deleting all files at source server.

Better is to make rsync server at your source(via xinetd for example, on centos it's very simple install xinetd, edit /etc/xinetd.d/rsync and change line disable = yes to disable = no, create files /etc/rsyncd.conf and there configure your resources and secrets files, restart xinetd, open rsync ports in iptables and thats all). Why is that? Because if your target server get compromised your data at source will be safe (ofcourse if your passwords will be different :). On source server you define resource in read mode only with access only for your target sever. It will be good if you define at source server a rule in iptables for accepting connections only from your target . Good idea will be running rsync at not default port (Once again at centos you can change rsync server port by editing /etc/services).

After that you can write a bash script and put it in crontab at target server to synchronize data.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.