home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Previous Section Next Section

-bs

Run SMTP on standard input All versions

The -bs command-line switch causes sendmail to run a single SMTP session in the foreground over its standard input and output, and then exit. The SMTP session is exactly like a network SMTP session. Usually, one or more messages are submitted to sendmail for delivery.

This mode is intended for use at sites that wish to run sendmail with the inetd(8) daemon. To implement this, place an entry such as the following in your inetd.conf(5) file, then restart inetd(8) by killing it with a SIGHUP signal:

smtp   stream  tcp   nowait  root /usr/sbin/sendmail sendmail -bs

With this scheme it is important to either use cron(3) to run sendmail periodically to process its queue:[8]

[8] The look of these lines varies depending on the version of Unix you are running.

0 * * * * /usr/sbin/sendmail -q

or run sendmail in the background to process the queue periodically by specifying an interval to the -q command-line switch's interval (Section 11.8.1):

/usr/sbin/sendmail -q1h

There are advantages and disadvantages to using inetd(8) instead of the -bd daemon mode to listen for and process incoming SMTP messages. The advantages are the following:

  • At security-conscious sites, sendmail can be hidden behind a tcpd(8) or miscd(8) wrapper that can selectively accept or reject connections. (But see TCPWRAPPERS in TCPWRAPPERS for a way to include this support directly inside sendmail.)

  • At hosts that receive few incoming mail messages, this mode avoids the need to run a daemon.

The disadvantages are the following:

  • At sites that receive many incoming mail messages, this mode causes a new sendmail process to be started for each connection. Compared to daemon mode, this can adversely affect system performance.

  • At highly loaded sites, with older versions of inetd(8), this mode circumvents the sendmail program options that are intended to avoid overloading the system with too many concurrent sendmail processes.

In general, the inetd(8) approach should be used only on lightly loaded machines that receive few SMTP connections.

The -bs switch is also useful for MUAs that prefer to use SMTP rather than a pipe to transfer a mail message to sendmail. Depending on how it is configured, mh(1) can use this feature.

    Previous Section Next Section