rsync

rsync同步FTP文件-1-更新脚本

和自甴很熟 提交于 2019-12-23 00:15:52
大意如下,针对上次的脚本经常卡住不同步,所以更新脚本,思路是这个样子的: 每4个小时 强制杀死同步进程 然后顺序执强制卸载挂载目录 然后等待30秒 然后再执行挂载。 然再执行同步命令。 [root@let28 fileos]# cat france24-ftp #!/bin/bash /usr/bin/ps -ef|grep rsync |grep -v grep|awk '{print "kill -9 " $2}' |sh /usr/bin/umount -lf /mnt/france24 echo "1" /usr/bin/sleep 30s echo "2" /usr/bin/curlftpfs -o uid=1003,gid=1003,codepage=gbk ftp://XXXX:XXX_FTP@ftp.france24.com /mnt/france24 echo "3" RSYNCST=`ps -ef |grep -v grep |grep /usr/bin/rsync|grep france24|wc -l` if [ $RSYNCST -eq 1 ];then nohup /usr/bin/rsync -avzP --delete --exclude=/Ar /mnt/france24/ /home/fileos/file/merge/france24/ &

rsync+inotify文件实时同步

て烟熏妆下的殇ゞ 提交于 2019-12-22 14:15:00
rsync命令的基本用法: 格式: rsync [选项] 源文件 目标文件 选项: -a,--archive:归档模式,表示用归档的方式传输文件,并且保持文件的属性,等于加了参数 -rlptgoD -r,recursive:对子目录用递归模式处理 -l,--links:表示考本链接文件 -p,--perms:表示保持文件原有权限 -t,--times:表示保持文件原有时间 -g,--group:表示保持文件原有用户组 -o,--owner:表示保持文件原有属主 -D,--devices:表示块设备文件信息 -z,--compress:表示压缩传输 -H:表示硬链接问价 -A:保留ACL属性信息 -P:显示传输进度 --delete:删除那些目标位置有而且原始位置没有的文件 常用选项:-avz --progress -P 推送文件: rsync -avz --progress -P /root/test.sh 192.168.0.1:/root 拉取文件: rsync -avz --progress -P 192.168.0.1:/root/test.sh /root/test/test/ 注意: 1、如果对端服务器没有安装rsync服务,那么rsync是既无法实现推送文件也无法实现拉取文件 2、rsync是基于ssh协议的,默认是2 来源: CSDN 作者: vincen

detect if something is modified in directory, and if so, backup - otherwise do nothing

跟風遠走 提交于 2019-12-22 12:39:31
问题 I have a "Data" directory, that I rsync to a remote NAS periodically via a shell script. However, I'd like to make this more efficient. I'd like to detect if something has changed in "Data" before running rsync. This is so that I don't wake up the drives on the NAS unnecessarily. I was thinking of modifying the shell script to get the latest modified time of the files in Data (by using a recursive find), and write that to a file every time Data is rsynced. Before every sync, the shell script

Sync local and remote folders using rsync from php script without typing password

纵然是瞬间 提交于 2019-12-22 06:02:11
问题 How can I sync local and remote folders using rsync from inside a php script without beeing prompted to type a password? I have already set up a public key to automate the login on remote server for my user. So this is running without any problem from cli: rsync -r -a -v -e "ssh -l user" --delete ~/local/file 111.111.11.111:~/remote/; But, when I try to run the same from a PHP script (on a webpage in my local server): $c='rsync -r -a -v -e "ssh -l user" --delete ~/local/file 111.111.11.111:~

Sync local and remote folders using rsync from php script without typing password

心已入冬 提交于 2019-12-22 06:01:19
问题 How can I sync local and remote folders using rsync from inside a php script without beeing prompted to type a password? I have already set up a public key to automate the login on remote server for my user. So this is running without any problem from cli: rsync -r -a -v -e "ssh -l user" --delete ~/local/file 111.111.11.111:~/remote/; But, when I try to run the same from a PHP script (on a webpage in my local server): $c='rsync -r -a -v -e "ssh -l user" --delete ~/local/file 111.111.11.111:~

init script

こ雲淡風輕ζ 提交于 2019-12-21 23:27:26
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> #!/bin/bash # # /etc/rc.d/init.d/rsync # rsync This shell script takes care of starting and stopping # rsync (the Rsyncd Server) # # Author: Brian Jones jonesy@cs.princeton.edu # # chkconfig: 2345 13 87 # description: rsync is the Fedora Directory Service daemon. \ # FDS can serve as a repository for (and, subsequently, a source of) \ # data for most of the resources listed in /etc/nsswitch.conf, such as \ # passwd or group entries. # Source function library. . /etc/init.d/functions #OPTIONS="-D /opt/fedora-ds/slapd-ldap -i /opt/fedora-ds/slapd-ldap/logs/pid

rsync简明手册

拜拜、爱过 提交于 2019-12-21 18:10:27
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> rsync简明手册 !rsync同步模式 sync在进行同步或备份时,使用远程shell,或TCP连接远程daemon,有两种途经连接远程主机。 shell模式,不需要使用配置文件,也不需要启动远端rsync。远程传输时一般使用ssh作为传输工具。 daemon模式,但必须在一台机器上启动rsync。 !rsync命令调用格式 本地文件同步: rsync [OPTION...] SRC... [DEST] 示例: rsync -a /home/back1 /home/back2 基于远程shell同步: 拉取: rsync [OPTION...] [USER@]HOST:SRC... [DEST] 推送: rsync [OPTION...] SRC... [USER@]HOST:DEST 基于rsync daemon同步: 拉取: rsync [OPTION...] [USER@]HOST::SRC... [DEST] rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST] 推送: rsync [OPTION...] SRC... [USER@]HOST::DEST rsync [OPTION...] SRC... rsync://[USER@

keepalived+nginx+lnmp 网站架构

蓝咒 提交于 2019-12-21 13:43:05
《网站架构演变技术研究》 项目实施手册 2019年8月2日 第一章 : 实验环境确认 4 1.1-1.系统版本 4 1.1-2.内核参数 4 1.1-3.主机网络参数设置 4 1-1-4 .项目拓扑图 5 第二章 : 部署后端web服务 6 2-1 .安装Nginx服务端 6 2-1-1 .安装nginx 依赖包 6 2-1-3.修改Nginx配置文件 7 2-1-4.创建nginx启动文件软链接 8 2-1-5.启动nginx,开机自启 8 2-1-6. 查询端口80状况 8 2-1-7.安装其他web服务器 8 2-2 .部署PHP环境 9 2-2-1 .安装PHP 软件 9 2-2-3. 查询端口9000状况 9 2-2-3.安装其他web服务器 9 第三章 : 部署NFS服务 9 3-1 .安装NFS 服务器端 10 3.1-1 .nfs软件安装 10 3-1-2 .创建共享目录 10 3-1-3. 修改/etc/exports配置文件 10 3-1-4. 启动服务,开机自启 10 3-1-5. 本地挂载测试 10 3-2. 部署web客户端挂载nfs存储 11 3-2-1.配置web服务器 11 3-2-2.手动挂载-临时挂载 11 3-2-3. 配置开机自动挂载-永久挂载 11 3-2-4. 安装其他 web服务器 12 3-3. 部署rsync备份服务器 12 3-3

rsync同步

醉酒当歌 提交于 2019-12-21 10:38:56
需达成目标 :在服务器(192.168.18.211)端搭建 rsync 服务,      将 /root/rsync-server/ 目录同步到客户端 /root/rsync-local 目录 Linux系统 :CentOS 6.5 一、由于CentOS6.5已经默认已经安装了 rsync,如若没有安装,可以参考如下方法: 1、检查是否安装了 rsync : rpm -qa rsync 2、如果没有安装可以使用yum安装 yum install -y rsync 3、启动 rsync : /etc/init.d/xinetd start 或 service xinetd start 二、服务端(192.168.18.211)[每个人的IP肯定都不一样] 1、建立 rsync 账号密码文件: vim /root/rsync_user , 添加一行 账号 : 密码 root:123456 2、修改权限 chmod 600 rsync_user 3、创建 rsync 全局配置文件 vim /etc/rsyncd.conf (默认没有此配置文件,手动添加该文件),内容如下: uid = nobody  // 传输文件时,执行的用户 gid = nobody // 传输文件时,执行的用户组 use chroot = yes  // 在传输文件之前,服务器守护程序在将chroot

Apache user account passwordless access to the server - Ubuntu

懵懂的女人 提交于 2019-12-21 05:45:20
问题 I have the same issue which is in this question. If I explain it again, I can use rsync to sync my local data with the server without password(I used SSH keys). But when I use exec() function in PHP, it doesn't work. The person who has asked the above question has given the answer by himself. He says it can be done by allowing the Apache user account passwordless access to the serve. So my question is how do I provide Apache user account passwordless access to the server ? My PHP code is :