[Dovecot] dsync in a cronjob to replace offlineimap

Guilhem Moulin guilhem at fripost.org
Fri Feb 14 20:51:57 UTC 2014

Hi list,

Replacing offlineimap with dsync for IMAP-to-IMAP synchronization (using
dovecot 2.1.7) is working great, but now that I upgraded to 2.2.9 I'd
like to take advantage of the incremental replication [1].

I don't think having a separate replicator process & notifications suits
my configuration, as I want to sync my server with my laptop which is
not always on or might be behind a firewall.

After reading ‘replication/replicator/dsync-client.c’ I was thinking of
writing a small wrapper around dsync performing a daily full replication 
and updating the state otherwise.

The following works great in a cronjob

  doveadm sync -l30 imap.example.org

but when I try to get the current state

  doveadm sync -l30 -fs '' imap.example.org >~/mail/dsync.state

and later use incremental replication

  state=$(< ~/mail/dsync.state) doveadm sync -l30 -s "$state" imap.example.org >~/mail/dsync.state

the state seems to somehow quickly become "stale" and messages stop 
being retrieved from the server.

I understand that dsync's incremental replication is mostly intended to
be used by the replicator process, but I'm wondering whether it's also
possible to use it manually ;-) If so, how to keep a sane state?


[1] http://wiki2.dovecot.org/Replication
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://dovecot.org/pipermail/dovecot/attachments/20140214/beb7d0cd/attachment.sig>

More information about the dovecot mailing list