debian 文件服务器,Debian 使用Unison双向同步文件

Debian6.0 squeeze

Server1:192.168.1.104

Server2:192.168.1.105

Server1

#vi /etc/apt/sources.list

deb http://mirrors.163.com/debian squeeze main non-free contrib

deb http://mirrors.163.com/debian squeeze-proposed-updates main contrib non-free

deb http://mirrors.163.com/debian-security squeeze/updates main contrib non-free

deb-src http://mirrors.163.com/debian squeeze main non-free contrib

deb-src http://mirrors.163.com/debian squeeze-proposed-updates main contrib non-free

deb-src http://mirrors.163.com/debian-security squeeze/updates main contrib non-free

deb http://http.us.debian.org/debian squeeze main contrib non-free

deb http://non-us.debian.org/debian-non-US squeeze/non-US main contrib non-free

deb http://security.debian.org squeeze/updates main contrib non-free

#apt-get update

#apt-get install unison //两台Server都需要安装unison

#usr/bin/unison

#vi /root/.unison/default.prf

root = /root/test/

root = ssh://192.168.1.105//root/test/

#force =/root/test/

# Paths to synchronize

#path = bbs/attachments

#path = uc/data/avatar

#path = uchome/attachment

# Some regexps specifying names and paths to ignore

#ignore = Path bbs/attachments/swfupload

#ignore = Name temp.*

#ignore = Name *~

#ignore = Name .*~

#ignore = Name *.mp3

auto = true

batch = true

maxthreads = 500

owner = true

group = true

perms = -1

repeat = 1

retry = 3

sshargs = -C

xferbycopying = true

silent = true

fastcheck = true

log = true

logfile = /root/.unison/unixidc_122.1547.log

Server1创建/root/test

#mkdir /root/test

Server2创建/root/test

#mkdir /root/test

#/usr/bin/unison&

推送到后台安静模式运行

如果Server1的/root/test想同步到Server2的/root/test2

需要在Server1创建/root/test Server2创建/root/test2

配置文件为 root = ssh://192.168.1.105//root/test2/

其中要注意的是:

1.force去掉前面的# 那就是Server1单向同步到Server2

2.silent = true 是以安静模式运行 否则一直会有以下提示

root@localhost:~# /usr/bin/unison

Contacting server…

Connected [//localhost//root/test -> //unixidc//root/test]

Looking for changes

Waiting for changes from server

Reconciling changes

Nothing to do: replicas have not changed since last sync.

Sleeping for 1 seconds…

Looking for changes

Waiting for changes from server

Reconciling changes

Nothing to do: replicas have not changed since last sync.

3.path 是指定你需要同步的目录,用ignore指定path中需要排除的目录及文件

4.要双向同步的目录都不允许为空 否则unison进程会自动结束 并提示Aborting…0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值