首页 技术 正文
技术 2022年11月14日
0 收藏 988 点赞 2,396 浏览 1325 个字

ubuntu系统自带rsync,首先配置/etc/default/rsync,启用daemon模式

Ubuntu 14.04.2配置rsync

修改/etc/rsyncd.conf配置文件

cat /etc/rsyncd.conf
# sample rsyncd.conf configuration file# GLOBAL OPTIONS#motd file=/etc/motd
log file=/var/log/rsyncd
# for pid file, do not use /var/run/rsync.pid if
# you are going to run rsync out of the init.d script.
# The init.d script does its own pid file handling,
# so omit the "pid file" line completely in that case.
pid file=/var/run/rsyncd.pid
syslog facility=daemon
#socket options=# MODULE OPTIONS[image_ftp]comment = public archive#comment名称自定义
path = /var/www/html#需要同步的目录
use chroot = no
#max connections=10
lock file = /var/lock/rsyncd
# the default for read only is yes...
read only = yes
list = yes
uid = root
gid = root
#exclude =
#exclude from =
#include =
#include from =
auth users = root #该用户需和客户端拉取用户保持一致,这里以root为例
secrets file = /etc/rsyncd.secrets #用户密码文件
strict modes = yes
hosts allow = 192.168.1.100 #允许拉取的客户端ip
#hosts deny =
ignore errors = yes
ignore nonreadable = yes
transfer logging = yes
log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes.
timeout = 600
refuse options = checksum dry-run
dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz

创建存放用户名和密码的文件

vim /etc/rsyncd.secrets

启动rsync服务

/etc/init.d/rsync start

赋予600权限

chmod 600 /etc/rsyncd.secrets

查询服务是否启动,注意防火墙需要开放873端口

Ubuntu 14.04.2配置rsync

在客户端上执行拉取命令,nohup+& 让服务保持在后台运行,防止中断

nohup rsync -avuz -e 'ssh -p 2222' root@192.168.1.100:/var/www/html /data &
nohup rsync -avuz -e 'ssh -p 2222' root@192.168.1.100:/var/www/html /data
ctrl + z 挂起
bg 将进程置于后台运行
jobs 查询后台运行任务

  

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,085
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,560
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,409
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,182
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,819
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,902