Detailed OpenSync Installation/Usage Example

Initial installation

First, download and install: OpenSync, the plugins you plan to use, and Multisync.

Check if everything is installed

Check if the plugins were installed correctly. You should get something like this :

$ msynctool --listplugins
Available plugins:
file-sync
kdepim
evo2-sync
$

Test file-file synchronization

You can now test if snchronisation between two directories containing files work.

Create the group

$ msynctool --addgroup filefile
$

Add the file-sync members

$ msynctool --addmember filefile file-sync
$ msynctool --addmember filefile file-sync

The result should be:

$ msynctool --showgroup filefile
Group: filefile
Member 1: file-sync
        No Configuration found: Plugin is not configured
Member 2: file-sync
        No Configuration found: Plugin is not configured
$

Create the directories

In this example, we will use the directories sync1 and sync2 on the home directory. We will consider that the home directory is /home/joeuser. Please replace with the proper names.

$ mkdir ~/sync1
$ mkdir ~/sync2
$

Configure the members

Configuring the first member :

$ msynctool --configure filefile 1

This should open the vi text editor, where you can enter the configuration data for the member.

After opening the text editor, you should see a xml-file like this:

<?xml version="1.0"?>
<config>
  <directory>
    <path></path>
    <objtype>data</objtype>
  </directory>

  <!--

   Field objformat set the object format which should be used to store.
   objformat is optional - by default objformat is "file".

  -->

  <!--
  <directory>
    <path></path>
    <objtype>contact</objtype>
    <objformat>vcard30</objformat>
  </directory>
  -->

  <!--
  <directory>
    <path></path>
    <objtype>event</objtype>
    <objformat>vevent20</objformat>
  </directory>
  -->

</config>

now enter the directory path for the first member to that the config looks like this:

<?xml version="1.0"?>
<config>
  <!-- directory path for file-sync -->
  <path>/home/joeuser/sync1</path>

  <!-- should care of subdirectories (TRUE or FALSE) -->
  <recursive>FALSE</recursive>
</config>

Follow the same steps for the second member:

$ msynctool --configure filefile 2

And the configuration data should be:

<?xml version="1.0"?>
<config>
  <!-- directory path for file-sync -->
  <path>/home/joeuser/sync2</path>

  <!-- should care of subdirectories (TRUE or FALSE) -->
  <recursive>FALSE</recursive>
</config>

First test: empty directories

$ msynctool --sync filefile
Synchronizing group "filefile"
ERROR: No synchronizable objtype

We need to configure the objtype as well. To see what the current objtype is, we can use discover:

$ msynctool --discover filefile 1
Discovered Objtypes:
        data
                Format: file

The default objtype is data, and its format is file.

As we want to synchronise a vcard, we set the objtype to contact and the format to vcard:

<?xml version="1.0"?>
<config>
  <directory>
    <path>/home/joeuser/sync1</path>
    <objtype>contact</objtype>
    <objformat>vcard30</objformat>
  </directory>
</config>

If we discover again, we now get:

$ msynctool --discover filefile 1
Discovered Objtypes:
        contact
                Format: vcard30

If you get the following output instead:

$ msynctool --discover filefile 1
ERROR: Configured storage format "vcard30" for object type "contact" is unknown. Is the format plugin missing?

you need to install the vformat format-plugin (http://svn.opensync.org/format-plugins/vformat/)

Configure the the second member accordingly:

<?xml version="1.0"?>
<config>
  <directory>
    <path>/home/joeuser/sync2</path>
    <objtype>contact</objtype>
    <objformat>vcard30</objformat>
  </directory>
</config>

then discover it, then sync again:

$ msynctool --sync filefile
Synchronizing group "filefile"
ERROR: No synchronizable objtype
$ msynctool --discover filefile 2
Discovered Objtypes:
        contact
                Format: vcard30
$ msynctool --sync filefile
Synchronizing group "filefile"
contact sink of member 2 of type file-sync just connected
Main sink of member 2 of type file-sync just connected
contact sink of member 1 of type file-sync just connected
Main sink of member 1 of type file-sync just connected
All clients connected or error
contact sink of member 1 of type file-sync just sent all changes
Main sink of member 1 of type file-sync just sent all changes
contact sink of member 2 of type file-sync just sent all changes
Main sink of member 2 of type file-sync just sent all changes
All clients sent changes or error
All conflicts have been reported
contact sink of member 1 of type file-sync committed all changes.
Main sink of member 1 of type file-sync committed all changes.
contact sink of member 2 of type file-sync committed all changes.
Main sink of member 2 of type file-sync committed all changes.
All clients have written
contact sink of member 1 of type file-sync reported sync done.
Main sink of member 1 of type file-sync reported sync done.
contact sink of member 2 of type file-sync reported sync done.
Main sink of member 2 of type file-sync reported sync done.
All clients reported sync done
contact sink of member 2 of type file-sync just disconnected
contact sink of member 1 of type file-sync just disconnected
Main sink of member 1 of type file-sync just disconnected
Main sink of member 2 of type file-sync just disconnected
All clients have disconnected
The sync was successful
$

Second test: Add a sample vcard to the directory

Create a simple vcard file on ~/sync1. You can use you favorite PIM application to export some contacts to the vcard format.

To create a simple vcard file, copy the following contents to the file ~/sync1/vcard1.vcf using any editor:

BEGIN:VCARD
VERSION:2.1
N:Test User
END:VCARD

Synchronize:

$ msynctool --sync filefile
Synchronizing group "filefile"
contact sink of member 1 of type file-sync just connected
Main sink of member 1 of type file-sync just connected
contact sink of member 2 of type file-sync just connected
Main sink of member 2 of type file-sync just connected
All clients connected or error
contact sink of member 2 of type file-sync just sent all changes
Main sink of member 2 of type file-sync just sent all changes
Received a entry vcard1.vcf from member 1 (file-sync). Changetype ADDED
contact sink of member 1 of type file-sync just sent all changes
Main sink of member 1 of type file-sync just sent all changes
All clients sent changes or error
All conflicts have been reported
contact sink of member 1 of type file-sync committed all changes.
Main sink of member 1 of type file-sync committed all changes.
Sent a entry vcard1.vcf to member 2 (file-sync). Changetype ADDED
contact sink of member 2 of type file-sync committed all changes.
Main sink of member 2 of type file-sync committed all changes.
All clients have written
contact sink of member 1 of type file-sync reported sync done.
Main sink of member 1 of type file-sync reported sync done.
contact sink of member 2 of type file-sync reported sync done.
Main sink of member 2 of type file-sync reported sync done.
All clients reported sync done
contact sink of member 1 of type file-sync just disconnected
Main sink of member 1 of type file-sync just disconnected
contact sink of member 2 of type file-sync just disconnected
Main sink of member 2 of type file-sync just disconnected
All clients have disconnected
The sync was successful
$

The result should be:

$ ls ~/sync1
vcard1.vcf
$ ls ~/sync2
vcard1.vcf
$

It worked!