Unison无法备份隐藏的dotfiles

时间:2015-03-10 05:23:14

标签: linux configuration-files unison

我正在使用unison(文件同步工具)在我的linux机器(客户端)和linux ssh服务器(主机)之间同步文件。它会将dotfiles(以.开头的配置文件)同步,但它根本不会创建它们的备份。这是一个错误,还是我错过了一些明显的错误。在发送错误报告之前,我主要希望有人重新确认我没有做一些愚蠢的事情。下面是一个最小的unison配置文件以及重新创建错误的步骤。

### ~/.unison/Test.prf

### Roots of Syncronization
  root = /home/username
  root = ssh://root@<host-ip-here>//root/SyncDir
  sshargs = -C -i /home/username/ssh-key

### Directories to be Synced
  path = TestDir

### Backup Settings
  backuplocation = central
  backupdir = /root/BackupDir
  backup = Name *
  maxbackups = 9
  backupprefix = 
  backupsuffix = .$VERSION

以下是我在客户端计算机上运行以演示错误的内容:

~$ mkdir TestDir; 
~$ touch TestDir/testfile TestDir/.dottestfile
~$ ssh -i ssh-key root@<host-ip-here> 'mkdir SyncDir BackupDir'
~$ unison Test
~$ ssh -i ssh-key root@<host-ip-here> 'ls -A SyncDir/TestDir'
.dottestfile
testfile
~$ echo "some changes" > TestDir/testfile
~$ echo "some changes" > TestDir/.dottestfile
~$ unison Test
~$ ssh -i ssh-key root@<host-ip-here> 'ls -A SyncDir/TestDir'
.dottestfile
testfile
~$ ssh -i ssh-key root@<host-ip-here> 'ls -A BackupDir/TestDir'
testfile

1 个答案:

答案 0 :(得分:1)

所以事实证明这不是一个错误,我正在做一些愚蠢的事情。 backup = Name期望标准通配模式的TIL according to the unison manual, 这一行

backup = Name *

与名称中前导.的任何文件都不匹配。该行应

backup = Name {.*,*}