rsync

rsync so that files in source and destination directory are the same

随声附和 提交于 2019-12-13 02:29:03
问题 I am trying to do an rysnc which would cause files in the destination directory that are not in the source directory to be deleted. As a result there would be the same number of files in the source and destination directories. Based on google searches and other stack overflow inquiries I tried the following command: rsync -avz -e -d /home/web/dataprocess/testwind/*.dbf -d /home/web/newcheck/ --delete While this did rsync over the files from the source directory that were dbf files, it did not

Java Runtime.getRuntime().exec(cmd) command contain single quote

不问归期 提交于 2019-12-13 01:13:31
问题 I need to use Java to rsync several files using one command the following command works fine in shell rsync -avrz --timeout=100 rsync://10.149.21.211:8730/'logflow/click/file1 logflow/click/file2' /home/kerrycai/puller" but when i use the following Java code , it does not work String cmd = "rsync -avrz --timeout=100 rsync://10.149.21.211:8730/'logflow/click/file1 logflow/click/file2' /home/kerrycai/puller"; Process p = Runtime.getRuntime().exec(cmd); int ret = p.waitFor(); the ret value is

rsync算法原理及使用

那年仲夏 提交于 2019-12-12 18:41:30
如果服务器之间需要保持某些文件的一致,我们可以使用 scp 来复制,如果需要长期保持一致,可以配合 crontab 脚本来使用。但是此时我们有更优的方式,就是 rsync+crontab 来实现定时增量传输保持文件一致。 rsync 功能很强大,网上的资料也都很全,这里做一些简单的汇总。 rsync 原理 这一小节内容大幅度转载了 RSYNC 的核心算法 的内容,因为原文章写的太好,就不再狗尾续貂了,感兴趣的可以直接查看原文。他的翻译原文是: The rsync algorithm 。 rsync 是 linux 下同步文件的一个高效算法,用于同步更新两处计算机的文件和目录,并适当利用查找文件中的不同块以减少数据传输。 rsync 的主要特点就是增量传输,只对变更的部分进行传送。 增量同步算法 假如我们现在需要同步两个文件保持一致,并且只想传送不同的部分,那么我们就需要对两边的文件做 diff ,但是这两个问题在两台不同的机器上,无法做 diff 。如果我们做 diff ,就要把一个文件传到另一台机器上做 diff ,但这样一来,我们就传了整个文件,这与我们只想传输不同部的初衷相背。于是我们就要想一个办法,让这两边的文件见不到面,但还能知道它们间有什么不同。这就是 rsync 的算法。 rsync 同步算法 我们将同步源文件名称为 fileSrc ,同步目的文件叫 fileDst

Best way to wrap rsync progress in a gui?

爱⌒轻易说出口 提交于 2019-12-12 11:22:02
问题 I use rsync to synchronize files to Windows clients in a server agnostic way. What methods are available to send the progress of rsync to the parent process for display in a gui progress bar? I imagine two or three choices exist. (1) Watch STDOUT (2) Watch rsync.exe log file, similar to unix tail (3) Watch rsync console output in memory. Which one is best/preferred? 回答1: For this type of tasks, I use my own AutoIt script (freeware, Windows only). The script redirects the standard output into

Syncing local and remote directories using rsync+ssh+public key as a user different to the ssh key owner

杀马特。学长 韩版系。学妹 提交于 2019-12-12 08:45:19
问题 The goal is to sync local and remote folders over ssh. My current user is user1 , and I have a password-less access setup over ssh to a server server1 . I want to sync local folder with a folder on server1 by means of rsync utility. Normally I would run: rsync -rtvz /path/to/local/folder server1:/path/to/remote/folder ssh access works as expected, rsync is able to connect over ssh , but it returns "Permission denied" error because on server1 the folder /path/to/remote/folder is owned by user2

script-file vs command-line: rsync and --exclude

岁酱吖の 提交于 2019-12-12 08:38:27
问题 I have a simple test bash script which looks like that: #!/bin/bash cmd="rsync -rv --exclude '*~' ./dir ./new" $cmd # execute command When I run the script it will copy also the files ending with a ~ even though I meant to exclude them. When I run the very same rsync command directly from the command line, it works! Does someone know why and how to make bash script work? Btw, I know that I can also work with --exclude-from but I want to know how this works anyway. 回答1: Try eval : #!/bin/bash

Better way of `chowning` unknown uid/gid of files `rsync` (including an --exclude-from file) would consider as source files

僤鯓⒐⒋嵵緔 提交于 2019-12-12 04:17:13
问题 I am trying to change unknown uid's and gid's on files that my rsync command would consider as source files before I execute my rsync command. My rsync command includes an exclude file. The reason that I need to do this is explained in my question here. I have tried this find command: find /cygdrive/f -uid 4294967295 -exec chown 544. '{}' + -o -gid 4294967295 -exec chown .197121 '{}' + BUT, it does not handle the exclude file. By that I mean, the above find searches all of f drive for files

Safe way to synchronize ressources between servers through php / linux

烈酒焚心 提交于 2019-12-12 04:08:30
问题 I need to synchronize ressources from a master server to a slave server. I use rsync because it can synchronize folder recursively using incremental file list. I have been able to make it work the simpliest way using ssh-keys. Everything is fine but it doesn't work through php shell_exec function. Here is what I have done so far, and where I am getting stuck. Help would be appreciated! Master and slave servers are on ubuntu 14.04.4 Creation of the ssh-key folder within user's home directory.

Ansible - Run Task Against Hosts in a with_together Fashion

北城余情 提交于 2019-12-12 04:08:28
问题 I am currently taking two hosts and dynamically adding them to a group, followed by a synchronize task using with_together to use 3 lists of 2 elements in parallel to copy the specified files between two remote servers. Here's an example based on the idea: --- - name: Configure Hosts for Copying hosts: localhost gather_facts: no tasks: - name: Adding given hosts to new group... add_host: name: "{{ item }}" groups: copy_group with_items: - ["remoteDest1", "remoteDest2"] - name: Copy Files

rsync and MyISAM tables

怎甘沉沦 提交于 2019-12-11 16:46:22
问题 I'm trying to use rsync to backup MySQL data. The tables use the MyISAM storage engine. My expectation was that after the first rsync, subsequent rsyncs would be very fast. It turns out, if the table data was changed at all, the operation slows way down. I did an experiment with a 989 MB MYD file containing real data: Test 1 - recopying unmodified data rsync -a orig.MYD copy.MYD takes a while as expected rsync -a orig.MYD copy.MYD instantaneous - speedup is in the millions Test 2 - recopying