日期:2014-05-16  浏览次数:20656 次

目录共享问题求助!
在linux两个目录怎么实现互相镜像?比如在一个目录加文件 另一目录相应增加

------解决方案--------------------
没弄过 不知道下面的能否解决你的问题
http://doc.linuxpk.com/41302.html
http://www.163er.com/Server/Linux/58004.shtml
------解决方案--------------------
这样可以不?

[root@test2]# sh test.sh test1 test2
test1 test2

[root@test2]# cat test.sh
echo $1 $2
while true
do
ls $1>$1.txt
ls $2>$2.txt

comm $1.txt $2.txt -1|while read name
do
cp $2/$name $1
done

comm $1.txt $2.txt -2|while read name
do
cp $1/$name $2
done
sleep 5
done

------解决方案--------------------
用inotify+rsync可以实现文件的实时同步。不了解的可以QQ加我41031962