4 mailbox\-count \- Count mailboxes in a SQL database.
7 \fBmailbox-count\fR [\fIOPTIONS\fR]
13 Either a summary, or detailed report (with \fI\-\-detail\fR) of the
14 number of mailboxes per-domain contained in the database.
16 The summary shows only the per-domain mailbox count, while the
17 detailed report shows both the count and a list of mailboxes.
20 Mailbox-count produces a simple count of mailboxes that exist
21 per-domain in some SQL database. The default queries are compatible
22 with the schema used by PostfixAdmin
23 <http://postfixadmin.sourceforge.net/>, but it is possible to supply
24 your own queries via the \fI\-\-summary-query\fR and
25 \fI\-\-detail-query\fR options.
27 The summary report lists each domain, along with the number of
28 mailboxes owned by that domain. The order is determined by the summary
29 query, which lists the domains alphabetically by default.
31 The default detail report shows the same, but also contains a list of
32 each individual mailbox (again in alphabetical order) belonging to the
36 .IP \fB\-\-database\fR
37 The name of the database (or file, if SQLite) to which we should
40 Default: The name of the current user (Postgres only).
43 Produce a detailed report listing all mailboxes by domain.
45 .IP \fB\-\-detail-query\fR
46 SQL query used to produce the detail report. This should return the
47 set of all (domain, username) pairs. See the default value for an
50 Default: \(dqSELECT domain,username FROM mailbox ORDER BY domain;\(dq
53 Hostname where the database is located (Postgres-only).
55 Default: None, a UNIX domain socket connection is attempted (Postgres only)
57 .IP \fB\-\-password\fR
58 Password used to connect to the database (Postgres-only).
60 Default: None (assumes passwordless authentication)
63 Port number used to connect to the database (Postgres-only).
65 Default: None, a UNIX domain socket connection is attempted (Postgres only)
67 .IP \fB\-\-summary-query\fR
68 SQL query used to produce the summary report. This should return
69 (domain, user count) pairs. See the default value for an
72 Default: \(dqSELECT domain,COUNT(username) FROM mailbox GROUP BY domain ORDER BY domain;\(dq
74 .IP \fB\-\-username\fR
75 Username used to connect to the database (Postgres-only).
77 Default: The current user
79 .SH CONFIGURATION FILE
81 Any of the options above can be placed in a configuration file rather
82 than passed on the command line. An example config file
83 \fIdoc/mailbox-countrc.example\fR is included with the source. You can
84 edit it and rename it to either \fI$sysconfdir/mailbox-countrc\fR or
85 \fI~/.mailbox-countrc\fR. The variable \fI$sysconfdir\fR is determined
86 at build time and is typically \fI/etc\fR on UNIX systems.
91 The default summary report:
94 .I $ mailbox-count --database=postfixadmin.sqlite3
95 Summary (number of mailboxes per domain)
96 ----------------------------------------
103 The more detailed report:
106 .I $ mailbox-count --detail --database=postfixadmin.sqlite3
107 Detail (list of all mailboxes by domain)
108 ----------------------------------------
126 Send bugs to michael@orlitzky.com.