On Fri, 5 Jun 2020, Francis Augusto Medeiros-Logeay wrote:> Another related question: if backing up on another location on the same > computer, using -A doesn't seem to recreate the structure of the original > Maildir (for example, /var/mail/%d%n). > > Is there a way to do that?If I understand your question correctly (I may be missing context), you can use dsync for that, e.g.: DEST=mdbox:/path/to/$MAILBOX/mdbox dsync -u $MAILBOX backup $DEST where DEST is in "mail location" format (could also be "maildir:/path/to/Maildir") and $MAILBOX is a dovecot (virtual) user. My backup script does this: USERS=$(cat /etc/dovecot/virtual_passwd | cut -d: -f1) for MAILBOX in $USERS; do DEST=mdbox:/encrypted/snap_mail/$MAILBOX/mdbox dsync -v -u $MAILBOX backup $DEST done This runs periodically and does the local "backup". Another server picks that up, also periodically, using rsync, which is the real backup. Cheers.
On 6 Jun 2020, at 01:10, Bernardo Reino <reinob at bbmk.org> wrote:> > ?On Fri, 5 Jun 2020, Francis Augusto Medeiros-Logeay wrote: > >> Another related question: if backing up on another location on the same computer, using -A doesn't seem to recreate the structure of the original Maildir (for example, /var/mail/%d%n). >> >> Is there a way to do that? > > If I understand your question correctly (I may be missing context), you can use dsync for that, e.g.: > > DEST=mdbox:/path/to/$MAILBOX/mdbox > dsync -u $MAILBOX backup $DEST > > where DEST is in "mail location" format (could also be "maildir:/path/to/Maildir") > and $MAILBOX is a dovecot (virtual) user. > > My backup script does this: > > USERS=$(cat /etc/dovecot/virtual_passwd | cut -d: -f1) > for MAILBOX in $USERS; do > DEST=mdbox:/encrypted/snap_mail/$MAILBOX/mdbox > dsync -v -u $MAILBOX backup $DEST > done > > This runs periodically and does the local "backup". > Another server picks that up, also periodically, using rsync, which is the real backup. > > Cheers.Thanks Bernardo. That?s what I want to do. But it?s just that it is confusing when there is a -A parameter that backups up all users, but apparently no way to specify individual paths on the destination. So I guess the -A option is only useful when backing up to a remote location that already has the same set of users. It would be nice to be able to soecify a format for the destination path without having use loops. But loop it is, then. :) Best, Francis
On 05 Jun 2020, at 17:09, Bernardo Reino <reinob at bbmk.org> wrote:> USERS=$(cat /etc/dovecot/virtual_passwd | cut -d: -f1)Is that a standard file? It's not one I have. I would use (not that I have, but it seem like the way to get a list of users) USERS=$( doveadm user '*' ) -- You start a conversation you can't even finish it You're talkin' a lot, but you're not sayin' anything When I have nothing to say, my lips are sealed Say something once, why say it again?
On Sat, 6 Jun 2020, @lbutlr wrote:> On 05 Jun 2020, at 17:09, Bernardo Reino <reinob at bbmk.org> wrote: >> USERS=$(cat /etc/dovecot/virtual_passwd | cut -d: -f1) > > Is that a standard file? It's not one I have.No, of course not! :) That's just my userdb/passdb (passwd-file).> I would use (not that I have, but it seem like the way to get a list of users) > > USERS=$( doveadm user '*' )There was a time when user enumeration didn't work as I wanted (had userdb as static) so I did it that way. Now I can do doveadm user '*' and it returns the list of users, but didn't bother to change that (I'm talking about a total of 16 users... :) Cheers.