DOVEADM-BATCH(1)

✨ NAME ✨

doveadm-batch β€” run a whole bunch of commands for a whole bunch of users, bestie πŸ’–


🌸 SYNOPSIS 🌸

doveadm [-Dv] batch [-S socket_path] -A sep command sep command [...]
doveadm [-Dv] batch [-S socket_path] -F file sep command sep command [...]
doveadm [-Dv] batch [-S socket_path] -u usermask sep command sep command [...]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so doveadm batch is that girl πŸ’… she runs multiple doveadm(1) commands sequentially for multiple users. and like, the whole point is optimization β€” Dovecot gets to do all the mailbox operations for the same user in one go, instead of dragging itself through the users over and over again. it's giving efficiency, it's giving main character energy πŸ‘‘

There are three forms, and they're all lowkey iconic:

  1. First form: doveadm(1) loops over all the users defined in the configured user_db(s), and runs the sequence of commands for each one of them.
  2. Second form: doveadm(1) loops over all the users listed in the given file.
  3. Third form: the commands get executed for each user matching the given usermask.

periodt. ✨


πŸ’– OPTIONS πŸ’–

Global doveadm(1) options β€” these are the universal ones, the basics, the essentials:

  • -D β€” turns on verbosity and debug messages. she's chatty fr fr πŸ—£οΈ
  • -o setting=value β€” overrides the configuration setting from /etc/dovecot/dovecot.conf and from the userdb, using the value you give it. wanna override multiple settings? no stress, just pass -o as many times as you want πŸŽ€
  • -v β€” enables verbosity, including a progress counter. watching that counter go up? obsessed. πŸ“ˆ

Command specific options β€” these ones are just for batch:

  • -A β€” if -A is present, the command gets performed for all users. > heads up bestie: using this together with system users from userdb { driver = passwd } is not recommended, because that userdb also contains users with a lower UID than the one configured with the first_valid_uid setting 😭

also, when the SQL userdb module is in play, make sure the iterate_query setting in /etc/dovecot/dovecot-sql.conf.ext matches your database layout. and if you're on the LDAP userdb module, make sure the iterate_attrs and iterate_filter settings in /etc/dovecot/dovecot-ldap.conf.ext match your LDAP schema. otherwise doveadm(1) literally cannot iterate over all users and it will just... not. πŸ’€

  • -F file β€” execute the command for all the users in the file. it's similar to the -A option, except instead of pulling the user list from the userdb, they get read from the given file. the file contains one username per line. simple as that 🌈
  • -S socket_path β€” the argument here is either an absolute path to a local UNIX domain socket, or a hostname and port (hostname:port), so you can connect to a remote host via a TCP socket. this lets an administrator execute doveadm(1) mail commands through the given socket πŸ”₯
  • -u user/mask β€” run the command only for the given user. you can also use '*' and '?' wildcards (e.g. -u *@example.org) πŸ¦‹

and now the important bit: when neither the -A option, nor the -F file option, nor the -u user was specified, the command gets executed with the environment of the currently logged in user. iykyk πŸ’œ


πŸ‘‘ ARGUMENTS πŸ‘‘

  • command β€” any doveadm(1) command, with arguments and options β€” except for the -A, -S and -u options. those are off limits here, bestie πŸ™ˆ
  • sep β€” a single character used as the command separator, e.g. ':'. > be careful tho: unquoted characters, like ; or &, may get interpreted by your shell and then doveadm(1) will never see them. and then you'll be sad. don't be sad. πŸ’€

⭐ EXAMPLE ⭐

In this example we move seen mails, older than one month, for all example.net users to the alternative storage under /nfsmount:

mail_location = mdbox:~/mdbox:ALT=/nfsmount/%h/mdbox

The second command will remove messages with refcount=0 from the primary storage.

doveadm batch -u \*@example.net : altmove seen savedbefore 30d : purge

look at her go. absolutely ate. πŸ”₯


😭 REPORTING BUGS 😭

found a bug? report it, including your doveconf -n output, to the Dovecot Mailing List <dovecot@dovecot.org>. info about reporting bugs lives at: http://dovecot.org/bugreport.html 🫢


🌟 SEE ALSO 🌟

doveadm(1)


and that's the whole page, bestie!! this one comes to you from Dovecot v2.3, dated 2015-05-09 β€” yes she's an older icon but she still serves πŸ’…βœ¨