Once your MX record has taken effect, and once the hub has been configured to recognize the client machine as itself, no mail should ever again be delivered to your local machine. [5] Since there will be no incoming mail connections, you no longer need to run a sendmail daemon. Preventing the daemon from running involves two steps. First you need to kill the running daemon, then you need to modify your rc files so the daemon never runs again. We won't show you how to kill the daemon, because you have already learned that (see Section 4.1.1.1, "Kill and restart, beginning with V8.7"). Instead, we'll jump directly into preventing it from ever running again.
[5] Actually, some sites ignore MX records and try to deliver to your local machine anyway. See Section 36.7.11, -bs for a discussion of one way to solve this problem.
If you haven't already done so, search your rc files to see how sendmail is started when the machine first boots. Under SysV, for example, that command and its results might look like this:
%grep "sendmail.*-bd" /etc/init.d/*
/etc/init.d/mail: /usr/lib/sendmail -bd -q15m &
Under BSD 4.4 UNIX, however, they will look like this:
%grep sendmail /etc/rc*
/etc/rc:echo -n ' sendmail'; sendmail -bd -q30m
In the following, we will describe the BSD version. It is somewhat simpler to describe, but the underlying lessons are the same for both.
To be safe, save a copy of the rc file before changing it:
%cp /etc/rc /etc/rc.orig
Then edit the rc file and search for the shell commands that runs sendmail. They will look something like this:
echo -n ' nfsd'; nfsd -u -t 6 echo -n ' nfsiod'; nfsiod 4 echo -n ' sendmail'; sendmail -bd -q30m note echo -n ' inetd'; inetd
Find the line that runs the daemon (sendmail with the -bd
command-line switch) and remove the -bd
:
echo -n ' sendmail'; sendmail -q30m remove -bd
Extreme care must be taken in making changes to any of the rc files. These are executed only when the system is rebooted, so errors won't show up until a very awkward moment. A mistake here can potentially keep your workstation from booting.
The -bd
switch caused sendmail to run as a daemon
and listen for incoming SMTP connections. We removed that
switch so that sendmail would no longer listen for connections.
The -q30m
switch
that remains causes sendmail to process the queue once
every 30 minutes. We leave that switch in place because sendmail
still needs to process the queue periodically
[6]
(in case the hub is down).
[6] An alternative approach is to use cron(8) to execute sendmail periodically with a bare
-q
switch.