rsync.conf

Linux 2016. 2. 16. 18:09

[원본서버]


1. rsync install(update) rsync


[root@localhost ~]#yum install rsync    



2. /etc/rsyncd.conf 설정


log file = /var/log/rsyncd.log


[web]


comment         = web

path            = /home

hosts allow     = 123.123.123.123

uid             = root

gid             = root

use chroot      = yes

read only       = no

max connections = 10

timeout = 1000


~                                          



3. vi /etc/xinetd.d/rsync


disable = no 로 바꿔준다.



# default: off

# description: The rsync server is a good addition to an ftp server, as it \

#       allows crc checksumming etc.

service rsync

{

        disable = no

        socket_type     = stream

        wait            = no

        user            = root

        server          = /usr/bin/rsync

        server_args     = --daemon

        log_on_failure  += USERID

}



4. xinetd 재시작


$ service xinetd restart

xinetd 를 정지 중:                                         [  OK  ]

xinetd (을)를 시작 중:                                     [  OK  ]




xinetd  가 없을 경우 아래와 같이 설치


$ yum install xinetd




5. iptables 등록


iptables -A INPUT -s 클라이언트ip -p tcp --dport 873 -j ACCEPT






[복사하는 클라이언트]


rsync -azPog --delete root@123.123.123.123::web/ /home/


서버의 home 의 모든 내용이 클라이언트의 home 에 복사된다.




rsync -azPog --delete root@123.123.123.123::web/testuser /home/testuser/


서버의 /home/testuser 폴더의 내용이  클라이언트의 /home/testuser 폴더에 복사된다.




위의 명령어를 스크립트로 만들어 cron  에 등록한다.


vi /rsync_web.sh


#!/bin/sh




rsync -azPog --delete root@123.123.123.123::web/testuser /home/testuser/



#chmod 700 rsync_web.sh


#crontab -e



*/3 * * * * /home/rsync_web.sh

~                                        



매 3분마다 실행됨.


저장하고 나와서 crond 재시작


#service crond restart



cron 의 다른 옵션들은 아래 링크에서 확인


http://ellordnet.tistory.com/6







'Linux' 카테고리의 다른 글

CenOS 7 vsftpd 포트변경 및 passive mode 설정  (0) 2016.02.29
/dev/mapper/VolGroup-lv_root 100%  (0) 2016.02.23
linux top cpu usage  (0) 2016.02.15
top load average  (0) 2016.02.15
CentOS 7 SVN iptables  (0) 2016.01.29
블로그 이미지

엘로드넷

,