我正在尝试使用 Unison 同步两个目录,但是如果它遇到一个有错误的文件,它就会跳过整个目录!我认为它不应该跳过整个目录,而应该只跳过那个文件。我同意。我该如何告诉它忽略错误并继续复制其余文件?
Unison 是 Windows 可执行文件,而不是 Cygwin。我可以使用 Cygwin 读取文件。Unison 确实在文件上遇到了错误,我可以跳过它们。
2.32 版比 2.40 版运行得更好。2.40 版甚至无法启动。
我尝试添加 -ignore,但没有用。以下是我尝试的方法:
$ unison 'c:\cygwin' 'socket://xps:4321/c:/cygwin'
UNISON 2.32.52 started propagating changes at 02:53:35 on 27 Feb 2013
[ERROR] Skipping etc
[root 1]: Error in digesting c:/cygwin/etc/ssh_host_dsa_key:
c:/cygwin/etc/ssh_host_dsa_key: Permission denied
[ERROR] Skipping home
[root 1]: Error in digesting c:/cygwin/home/SYSTEM/.bash_history:
c:/cygwin/home/SYSTEM/.bash_history: Permission denied
...
Saving synchronizer state
Synchronization complete at 02:53:39 (3 items transferred, 2 skipped, 0 failed)
skipped: etc
skipped: home
$ unison 'c:\cygwin' 'socket://xps:4321/c:/cygwin' -ignore 'Path etc\ssh_host_dsa_key' -ignore 'Path home\SYSTEM\.bash_history'
Contacting server...
Connected [//dumbopc/c:/cygwin -> //xps/c:/cygwin]
Looking for changes
Waiting for changes from server
Reconciling changes
local xps
error etc
[root 1]: Error in digesting c:/cygwin/etc/ssh_host_dsa_key:
c:/cygwin/etc/ssh_host_dsa_key: Permission denied
error home
[root 1]: Error in digesting c:/cygwin/home/SYSTEM/.bash_history:
c:/cygwin/home/SYSTEM/.bash_history: Permission denied
...
Proceed with propagating updates? [] g
Propagating updates
UNISON 2.32.52 started propagating changes at 04:11:26 on 27 Feb 2013
[ERROR] Skipping etc
[root 1]: Error in digesting c:/cygwin/etc/ssh_host_dsa_key:
c:/cygwin/etc/ssh_host_dsa_key: Permission denied
[ERROR] Skipping home
[root 1]: Error in digesting c:/cygwin/home/SYSTEM/.bash_history:
c:/cygwin/home/SYSTEM/.bash_history: Permission denied
...
UNISON 2.32.52 finished propagating changes at 04:11:28 on 27 Feb 2013
Saving synchronizer state
Synchronization complete at 04:11:30 (6 items transferred, 2 skipped, 0 failed)
skipped: etc
skipped: home
# Version 2.40
C:\Program Files\Unison>"Unison-2.40.102 Text.exe" 'c:\cygwin' 'socket://xps:4321/c:\cygwin'
Contacting server...
Fatal error: Wrong number of roots: 2 expected, but 4 provided ('c:\cygwin', 'socket://xps:4321/c:\cygwin', , )
(Maybe you specified roots both on the command line and in the profile?)
@REM DOS
C:\cygwin\etc>type ssh_host_dsa_key
Access is denied.
# Cygwin
$ ls -l /etc/ssh_host_dsa_key
-rw------- 1 SYSTEM None 668 Aug 30 2010 /etc/ssh_host_dsa_key
$ cat /etc/ssh_host_dsa_key
-----BEGIN DSA PRIVATE KEY-----
命令行参考:
http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#prefs
答案1
我放弃了 Unison。我转而使用 Synchronize It,它可以保留修改时间,而且速度快 10 倍。但是,它不会双向传播删除操作。
同步:http://www.grigsoft.com/wndsync.htm
另外,关于错误
Wrong number of roots: 2 expected, but 4 provided
查看$HOME/.unison/default.prf
或%HOME%\.unison\default.prf
,检查是否有以 开头的行root=
,然后将其删除或移动到另一个配置文件。如果还有其他行,您可以查看它们以检查它们是否适合您的情况。(除了一些牵强附会的情况,在这些情况下,人们非常确定它们只同步一组目录树,default.prf
应该只包含选项,而不是根规范。)
也就是说,您可以创建并使用配置文件(.prf
.unison 目录中的文件),这些配置文件指定要同步的目录树根。任何配置文件都可能包括其他配置文件,甚至包括include default
。后一种情况很方便,可以共享一组要应用于所有配置文件的选项,甚至在启动 unison 时没有在命令行上指定配置文件时也是如此。有关详细信息,请参阅Unison 文档 - 配置文件。