[EdCert previous] [EdCert next] [EdCert top]

Invoking sendmail

sendmail has a large number of options that can be set on the command line, too many to go over here. See the manual page for specific information on each option. However, there are a few options that are important for all administrators.

sendmail Operating Modes

sendmail can be started in several different operating modes. These modes are selected with the -b (which stands for "be" or "become") option. The different operating modes are displayed in Table 1 (also available in plain text).
Table 1
sendmail's Operating Modes
-bd Run as a daemon.
-bi Initialize the alias database (same as newaliases command).
-bp Print the mail queue (same as mailq command).
-bs Run SMTP on standard input.
-bt Test mode for resolving addresses.
-bv Verify mode for verifying addresses.

The -bd option invokes sendmail as a daemon running in the background, listening to the SMTP port (port 25) for incoming connections. This mode is used by all systems during boot to enable electronic mail services.

The -bd option is important to remember because sendmail only reads its configuration file once, when it starts up. After any change to the sendmail.cf, kill sendmail and restart it as a daemon using the -bd option.

The Mail Queue

sendmail tries to deliver outgoing mail immediately, but, if it can't, it queues message in its mail queue (usually /var/spool/mqueue. If for instance, the system is too busy to transport mail at the moment, or if the remote host is down, sendmail will queue that message for later transport.

So, when invoking sendmail in daemon mode with -bd, it is standard to also tell it to process the queue every so often. The -q option does this. By itself, -q will tell sendmail to process the queue one time. When given a time, such as in -q30m sendmail processes the queue at the given interval.

The time given to the -q option is a number tagged with an 's' for seconds, an 'm' for minutes, an 'h' for hours, a 'd' for days, and a 'w' for weeks. So, -q1h30m causes sendmail to process the queue every one hour and thirty minutes.

Putting It All Together

So, combining all this information, the standard way to invoke a sendmail daemon is with the command:

sendmail -bd -q30m

changing the queue interval to fit the system's needs (although fifteen or thirty minutes is pretty standard for a normal workstation).

All systems start up sendmail in their normal boot scripts (usually /etc/rc* or /etc/init.d/*), so look there for the command-line options that your system uses, in case it varies.


Terms used: sendmail, daemon, SMTP, boot.



[EdCert previous] [EdCert next] [EdCert top]