]> gitweb.michael.orlitzky.com - mailbox-count.git/blob - doc/man1/mailbox-count.1
mailbox-count.cabal: bump to version 0.0.8
[mailbox-count.git] / doc / man1 / mailbox-count.1
1 .TH mailbox-count 1
2
3 .SH NAME
4 mailbox\-count \- Count mailboxes in a SQL database.
5 .SH SYNOPSIS
6
7 \fBmailbox-count\fR [\fIOPTIONS\fR]
8 .SH INPUT
9 .P
10 None.
11 .SH OUTPUT
12 .P
13 Either a summary, or detailed report (with \fI\-\-detail\fR) of the
14 number of mailboxes per-domain contained in the database.
15 .P
16 The summary shows only the per-domain mailbox count, while the
17 detailed report shows both the count and a list of mailboxes.
18 .SH DESCRIPTION
19 .P
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.
26 .P
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.
30 .P
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
33 domains.
34 .SH OPTIONS
35
36 .IP \fB\-\-database\fR
37 The name of the database (or file, if SQLite) to which we should
38 connect.
39
40 Default: The name of the current user (Postgres only).
41
42 .IP \fB\-\-detail\fR
43 Produce a detailed report listing all mailboxes by domain.
44
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
48 example.
49
50 Default: \(dqSELECT domain,username FROM mailbox ORDER BY domain;\(dq
51
52 .IP \fB\-\-host\fR
53 Hostname where the database is located (Postgres-only).
54
55 Default: None, a UNIX domain socket connection is attempted (Postgres only)
56
57 .IP \fB\-\-password\fR
58 Password used to connect to the database (Postgres-only).
59
60 Default: None (assumes passwordless authentication)
61
62 .IP \fB\-\-port\fR
63 Port number used to connect to the database (Postgres-only).
64
65 Default: None, a UNIX domain socket connection is attempted (Postgres only)
66
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
70 example.
71
72 Default: \(dqSELECT domain,COUNT(username) FROM mailbox GROUP BY domain ORDER BY domain;\(dq
73
74 .IP \fB\-\-username\fR
75 Username used to connect to the database (Postgres-only).
76
77 Default: The current user
78
79 .SH CONFIGURATION FILE
80
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.
87
88 .SH EXAMPLES
89
90 .IP \[bu] 2
91 The default summary report:
92
93 .nf
94 .I $ mailbox-count --database=postfixadmin.sqlite3
95 Summary (number of mailboxes per domain)
96 ----------------------------------------
97 example.com: 3
98 example.invalid: 1
99 example.net: 2
100 example.org: 1
101 .fi
102 .IP \[bu]
103 The more detailed report:
104
105 .nf
106 .I $ mailbox-count --detail --database=postfixadmin.sqlite3
107 Detail (list of all mailboxes by domain)
108 ----------------------------------------
109 example.com (3):
110 user1
111 user3
112 user5
113
114 example.invalid (1):
115 user7
116
117 example.net (2):
118 user2
119 user4
120
121 example.org (1):
122 user6
123 .fi
124 .SH BUGS
125 .P
126 Send bugs to michael@orlitzky.com.