Kill and Restart, Beginning with V8.7

Killing and restarting the sendmail daemon became easier beginning with V8.7. A single command[16] will kill and restart the daemon. In the following command, you might need to replace the path /var/run with one appropriate to your operating system (such as /etc/mail):

% kill -HUP `head −1 /var/run/sendmail.pid'

This single command has the same effect as the two commands shown for V8.6 in the following sections.

Kill and restart with V8.6

Before you can start the sendmail daemon, you need to make sure there is not a daemon running already.

Beginning with V8.6, the pid of the currently running daemon is found in the first line of the /etc/mail/sendmail.pid file. The process of killing the daemon looks like this:

% kill −15 `head −1 /etc/mail/sendmail.pid'

After killing the currently running daemon, you can start a new daemon with the following simple command:

% `tail −1 /etc/mail/sendmail.pid'

Kill and restart, very old versions

Under old versions of sendmail, you need to use the ps(1) program to find the pid of the daemon. How you run ps is different on BSD Unix and System V Unix. For BSD Unix the command you use and the output it produces resemble the following:

% ps ax | grep sendmail | grep -v grep
   99    ?  IW    0:07 /usr/lib/sendmail -bd -q1h
% kill −15 99

Here, the leftmost number printed by ps (the 99) was used to kill the daemon.

For System V-based systems you use different arguments for the ps command, and its output differs:

% ps -ae | grep sendmail 99 ...

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.