Vdirsyncer. Синхронизация адресной книги и календаря

Синхронизация локальной базы контактов и календаря.

Содержание

1 Общая информация

2 Установка

  • Linux
    • Gentoo

      emerge vdirsyncer
      

3 Конфигурирование

3.1 Типовая конфигурация

  • В поставке идёт пример файла конфигурации:

    # An example configuration for vdirsyncer.
    #
    # Move it to ~/.vdirsyncer/config or ~/.config/vdirsyncer/config and edit it.
    # Run `vdirsyncer --help` for CLI usage.
    #
    # Optional parameters are commented out.
    # This file doesn't document all available parameters, see
    # http://vdirsyncer.pimutils.org/ for the rest of them.
    
    [general]
    # A folder where vdirsyncer can store some metadata about each pair.
    status_path = "~/.vdirsyncer/status/"
    
    # CARDDAV
    [pair bob_contacts]
    # A `[pair <name>]` block defines two storages `a` and `b` that should be
    # synchronized. The definition of these storages follows in `[storage <name>]`
    # blocks. This is similar to accounts in OfflineIMAP.
    a = "bob_contacts_local"
    b = "bob_contacts_remote"
    
    # Synchronize all collections that can be found.
    # You need to run `vdirsyncer discover` if new calendars/addressbooks are added
    # on the server.
    
    collections = ["from a", "from b"]
    
    # Synchronize the "display name" property into a local file (~/.contacts/displayname).
    metadata = ["displayname"]
    
    # To resolve a conflict the following values are possible:
    #   `null` - abort when collisions occur (default)
    #   `"a wins"` - assume a's items to be more up-to-date
    #   `"b wins"` - assume b's items to be more up-to-date
    #conflict_resolution = null
    
    [storage bob_contacts_local]
    # A storage references actual data on a remote server or on the local disk.
    # Similar to repositories in OfflineIMAP.
    type = "filesystem"
    path = "~/.contacts/"
    fileext = ".vcf"
    
    [storage bob_contacts_remote]
    type = "carddav"
    url = "https://owncloud.example.com/remote.php/carddav/"
    #username =
    # The password can also be fetched from the system password storage, netrc or a
    # custom command. See http://vdirsyncer.pimutils.org/en/stable/keyring.html
    #password =
    
    # CALDAV
    [pair bob_calendar]
    a = "bob_calendar_local"
    b = "bob_calendar_remote"
    collections = ["from a", "from b"]
    
    # Calendars also have a color property
    metadata = ["displayname", "color"]
    
    [storage bob_calendar_local]
    type = "filesystem"
    path = "~/.calendars/"
    fileext = ".ics"
    
    [storage bob_calendar_remote]
    type = "caldav"
    url = "https://owncloud.example.com/remote.php/caldav/"
    #username =
    #password =
    

3.2 Синхронизация с Google

3.3 Синхронизация с Office 365

3.4 Синхронизация с Yandex

3.5 Синхронизация с Fuux

4 Утилиты для работы с vdir

5 Работа из Emacs

6 Обслуживание

6.1 Запуск через таймер systemd

  • Дистрибутив включает файлы модулей для запуска с определённым интервалом (по умолчанию каждые 15 ± 5 минут).

  • Файл vdirsyncer.service:

    [Unit]
    Description=Synchronize calendars and contacts
    Documentation=https://vdirsyncer.readthedocs.org/
    
    [Service]
    ExecStart=/usr/bin/vdirsyncer sync
    RuntimeMaxSec=3m
    Restart=on-failure
    
  • Файл vdirsyncer.timer:

    [Unit]
    Description=Synchronize vdirs
    
    [Timer]
    OnBootSec=5m
    OnUnitActiveSec=15m
    AccuracySec=5m
    
    [Install]
    WantedBy=timers.target
    
  • Для запуска на уровне пользователя скопируйте их в каталог ~/.config/systemd/user.

  • Для активации и запуска выполните:

    systemctl --user enable vdirsyncer.timer
    systemctl --user start vdirsyncer.timer
    

Дмитрий Сергеевич Кулябов
Дмитрий Сергеевич Кулябов
Профессор кафедры теории вероятностей и кибербезопасности

Мои научные интересы включают физику, администрирование Unix и сетей.

Похожие