虚拟机配置rsync同步

虚拟机配置rsync同步

 

安装

apt install rsync

 

修改配置文件

vim /etc/rsyncd.conf

 

uid = nobody

gid = nogroup

use chroot = no

max connections = 4

pid file = /var/run/rsyncd.pid

lock file = /var/run/rsync.lock

log file = /var/log/rsyncd.log

 

[html]

   path = /home/xuxb/html

   comment = My shared folder

   read only = no

   list = yes

 

[www]

   path = /var/www/html

   comment = My shared folder

   read only = no

   list = yes

 

创建目录并赋权

mkdir -p /home/xuxb/html/

chown -R nobody:nogroup /home/xuxb/html/

 

安装服务:

systemctl enable rsync

 

 

 

查看服务运行状态

systemctl status rsync

 

 

 

 

netstat -ntlp

 

 

 

 

开启服务

systemctl start rsync

 

 

 

windows上同步脚本

 

@echo off

title virtualbox系统

echo start uploading ....

 

:BEGIN

 

d:

 

cd "D:\software\ICW\bin"

 

echo 开始同步virtualbox项目 ....

 

rsync -avz --delete ^

      --exclude "/readme.txt" ^

      --exclude "logs/" ^

      --exclude "data/" ^

      --exclude ".git/" ^

      --exclude "/pub.php" ^

      --exclude "upload/" ^

      /cygdrive/d/workspace/html/ ^

      rsync://192.168.56.103:873/html/

 

echo virtualbox项目同步成功 ....

 

 

timeout /t 5 /nobreak > nul  

 

goto BEGIN

 

posted @ 2024-12-14 15:32  河北大学-徐小波  阅读(2)  评论(0编辑  收藏  举报