由於工作需要將Windows2003的檔案
同步到Linux系統中,這裡我將具體配置記錄下來;
這裡只配置windows-->linux的檔案同步其實這裡說成複製更確切些;
1.在windows2003上面安裝cwrsync的伺服器端軟體
herod_xiao的部落格" src="http://img.bimg.126.net/photo/3KI0JZCERC5CNkWJl973Ag==/1425952232017870471.jpg" alt="Windows與linux間檔案同步 - herod_xiao - herod_xiao的部落格">
2.修改其配置文檔rsyncd.conf
use chroot = false
strict modes = false
hosts allow = *
log
file = rsyncd.log
pid file = rsyncd.pid
#uid = root
#gid = root
# Module definitions
# Remember cygwin naming conventions :
c:/work becomes /cygwin/c/work
#
# [test]
# path =
/cygdrive/c/work
# read only = false
# transfer logging = yes
[syncdata]
path = /cygdrive/e/lt5 同步的目錄為e盤的
lt5檔案夾
read only = false
transfer logging = yes
#auth
user = root
#uid = root
#gid = root
#secrets file =
/cygdrive/e/rsyncd.secrets
3.在服務內將RsyncServer設定為自動
4.在linux伺服器內的配置
查看是否安裝rsync用戶端工具
[root@finet210 ~]# yum list | grep rsync
rsync.i386
2.6.8-3.1 installed
在計劃任何內添加如下內容
crontab -e
0 */2 * * * rsync -vzrtopg --progress --delete root@192.168.10.10::syncdata
/usr/local/www/htdocs/syncdata;
同步時間可以自己調整
有個重要的問題需設定,由於以上述方法同步後檔案許可權全部改變了,所有需設定一個非常關鍵的配置如下
在原來crontab內添加一條命令
0 */2 * * * rsync -vzrtopg --progress --delete root@192.168.10.10::syncdata
/usr/local/www/htdocs/syncdata; chown -R root:root
/usr/local/www/htdocs/syncdata
同步完成後並馬上修改目錄的屬性,這樣就沒問題了
配置也就完成了,其實有時還是很實用的,呵呵!
原創於2010-1-08 轉載請附上本人部落格路徑http://blog.163.com/herod_xiao