Parsing
of the mailstats program's
output can be made more program-friendly with the use of the
-p command-line switch:
% mailstats -p
938478602 938718475
0 0 0 247 686 0 0 prog
3 42 96 2 5 0 0 local
5 472 1710 10 22 5 0 esmtp
T 514 1806 259 713 5 0
C 514 259 5
Here, the first line contains two dates in Unix
time(2) format. The first is the date/time the
file was created (or zeroed), and the second is the date/time
mailstats was run.
The rest of the lines are what you have already seen when
mailstats was run without the
-p. The M heading and
attractive horizontal lines are missing, but the data is the same in
both cases.
If the user running the mailstats program has
write permission to the statistics file, this -p
switch will also cause that file's contents to
become zeroed. If the user running the program lacks write permission
to the statistics file, that file's contents will
not be zeroed. Zeroing and not zeroing are silent. You need to run
the mailstats program a second time to discover
if the statistics file has been zeroed.
Beginning with V8.12 sendmail, you can use the
-P command-line switch (discussed next) to print
statistics in program-friendly form, without zeroing the statistics.
Note that the -o switch can combined with the
-p switch to produce program-friendly output that
excludes the last, human-readable column:
% mailstats -p -o
938478602 938718475
0 0 0 247 686 0 0
3 42 96 2 5 0 0
5 472 1710 10 22 5 0
T 514 1806 259 713 5 0
C 514 259 5