Полезная информация


sendmailSearch this book
Previous: 3.3 Role in Network TransportChapter 3
The Roles of sendmail
Next: 3.5 Things to Try

3.4 Role as a Daemon

Just as sendmail can transport mail messages over a TCP/IP-based network, it can also receive mail that is sent to it over the network. To do this, it must be run in daemon mode. A daemon is a program that runs in the background independent of terminal control.

As a daemon, sendmail is run once, usually when your machine is booted. Whenever an email message is sent to your machine, the sending machine talks to the sendmail daemon that is listening on your machine.

To see how your system runs sendmail in daemon mode, run one of the following commands:

% grep sendmail /etc/rc*         <- BSD-based systems
% grep sendmail /etc/init.d/*    <- SysV-based systems
% grep sendmail /etc/*rc         <- HP-UX systems (prior to 10.0)

One typical example of what you will find is

/etc/rc.local:if [ -f /usr/lib/sendmail -a -f /etc/sendmail.cf ]; then
/etc/rc.local:   /usr/lib/sendmail -bd -q1h; echo -n ' sendmail'

The second line above shows that sendmail is run at boot time with a command line of

/usr/lib/sendmail -bd -q1h

The -bd command-line switch tells sendmail to run in daemon mode. The -q1h command-line switch tells sendmail to wake up once per hour and process the queue. Command-line switches are introduced in Chapter 5, The sendmail.cf File, and covered in detail in Chapter 36, The Command Line.

Previous: 3.3 Role in Network TransportsendmailNext: 3.5 Things to Try
3.3 Role in Network TransportBook Index3.5 Things to Try