Unison: Difference between revisions

From miki
Jump to navigation Jump to search
Line 36: Line 36:


== Basic Profile ==
== Basic Profile ==
Here we assume that all profiles will include the default one. If not, a more complex solution is to create a file <tt>.unison/common-prefs</tt>, that would be included by all profiles, including the default one.

Here a basic setup to backup pen usb stick on Cygwin:
Here a basic setup to backup pen usb stick on Cygwin:
{{hiddenSourceFile|~/.unison/|common-prefs|<pre class="common-prefs">
{{hiddenSourceFile|~/.unison/|common-prefs|<pre class="common-prefs">

</pre>
}}

{{hiddenSourceFile|~/.unison/|default.prf|<pre class="default.prf">
#Fastcheck - by default false on windows machine, and true on Unix machine.
#Fastcheck - by default false on windows machine, and true on Unix machine.
#When true, uses modification date + file size as inode number. Otherwise do a full scan
#When true, uses modification date + file size as inode number. Otherwise do a full scan
Line 44: Line 51:
# If any new preferences are added by Unison (e.g. 'ignore'
# If any new preferences are added by Unison (e.g. 'ignore'
# preferences added via the graphical UI), then store them in the
# preferences added via the graphical UI), then store them in the
# default profile file
# file 'common-prefs' rathen than in the top-level preference file
addprefsto = common-prefs
addprefsto = default.prf


#Common ignore specification
#Common ignore specification
ignore = Name System Volume Information
ignore = Name System Volume Information</pre>
</pre>
}}

{{hiddenSourceFile|~/.unison/|default.prf|<pre class="default.prf">
# Unison preferences file
include common-prefs
</pre>
}}
}}


Line 67: Line 67:


# Common include
# Common include
include common-prefs
include default.prf
</pre>
</pre>
}}
}}

Revision as of 14:02, 7 October 2011

References

Basic usage

  • Synchronize two directories
unison <dir-a> <dir-b>
  • Selecting files to synchronize
    • Synchronize home directory, using Ignore facility to skip some files.
    • Create a subdirectory called shared, and synchronize that directory only.
    • (Linux only) Create a subdirectory called shared, with symbolic links to other local directories, and synchronize that directory only using follow (making symlink transparent).
    • Synchronize home directory as root, using -path switch on the command line:
      unison /home/username ssh://remotehost//home/username -path shared
      

      The -path option can be used as many times as needed, to synchronize several files or subdirectories:

      unison /home/username ssh://remotehost//home/username \
          -path shared \
          -path pub \
          -path .netscape/bookmarks.html
      

      These -path arguments can also be put in your preference file.

Configuration tips

  • On Samba / CIFS file system, ignore permissions:
perms = 0

Basic Profile

Here we assume that all profiles will include the default one. If not, a more complex solution is to create a file .unison/common-prefs, that would be included by all profiles, including the default one.

Here a basic setup to backup pen usb stick on Cygwin: