Monday, August 25, 2003

Want to make sendmail's -bP flag work? What's -bP do, you ask? It prints the size of your mail queue (rather like the last line of mailq (aka sendmail -bp)) without printing all of the entries in the mail queue.

First make sure your sendmail was compiled with shared memory support. Run 'sendmail -bv -d0.12 root' and look for SM_CONF_SHM. (Documented here)

Then add the following to your sendmail.m4:

define(`confSHARED_MEMORY_KEY', `42')

The value is arbitrary, it just can't be 0 (zero). If you happen to be running more than one copy of sendmail on your box with different queues, each sendmail config file should use a different value. (Documented (vaguely) here) Rebuild your sendmail.cf, restart sendmail, and -bP should work.