Linux Network Administratoramp;#039;s Guide (3rd Edition) [Electronic resources]

Tony Bautts, Terry Dawson, Gregor N. Purdy

نسخه متنی -صفحه : 121/ 94
نمايش فراداده

12.7. Running sendmail

The sendmail daemon can be run in either of two ways. One way is to have to have it run from the inetd daemon; the alternative, and more commonly used method, is to run sendmail as a standalone daemon. It is also common for mailer programs to invoke sendmail as a user command to accept locally generated mail for delivery.

When running sendmail in standalone mode, place the sendmail command in a startup file so that it runs at boot time. The syntax used is commonly:

/usr/sbin/sendmail -bd -q10m

The -bd argument tells sendmail to run as a daemon. It will fork and run in the background. The -q10m argument tells sendmail to check its queue every ten minutes. You may choose to use a different time interval to check the queue.

To run sendmail from the inetd network daemon, you'd use an entry such as this:

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

The -bs argument here tells sendmail to use the SMTP protocol on stdin/stdout, which is required for use with inetd.

When sendmail is invoked this way, it processes any mail waiting in the queue to be transmitted. When running sendmail from inetd, you must also create a cron job that runs the runq command periodically to service the mail spool periodically. A suitable cron table entry would be similar to:

# Run the mail spool every fifteen minutes
0,15,30,45     *     *     *     *     /usr/bin/runq

In most installations sendmail processes the queue every 15 minutes as shown in our crontab example. This example uses the runq command. The runq command is usually a symlink to the sendmail binary and is a more convenient form of:

# sendmail -q