sudo apt-get update
sudo apt-get install rsync
sudo vim /etc/default/rsync
RSYNC_ENABLE=true # false to true
cat /lib/systemd/system/rsync.service
[Unit]
Description=fast remote file copy program daemon
Documentation=man:rsync(1) man:rsyncd.conf(5)
ConditionPathExists=/etc/rsyncd.conf
After=network.target
[Service]
ExecStart=/usr/bin/rsync --daemon --no-detach
[Install]
WantedBy=multi-user.target
配置文件说明--官方文档
配置文件有三类: 注释, 参数, 模块
#
表示注释;- 参数的格式:
name = value
; - 模块格式:
[module_name]
;
# /etc/rsyncd: configuration file for rsync daemon mode
# See rsyncd.conf man page for more options.
# configuration example:
uid = root
gid = root
port = 873
use chroot = no
max connections = 4
pid file = /var/run/rsyncd.pid
transfer logging = yes
timeout = 900
# secrets file = /etc/rsyncd.secrets
ignore nonreadable = yes
# dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2
[rsyncdata]
path = /home/parallels/Workspace/rsyncdata
sudo systemctl start rsync.service
rsync -av <src_path> <des_ip>::rsyncdata