summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/defaults/rc.conf27
-rw-r--r--etc/mail/Makefile108
-rw-r--r--etc/rc42
-rw-r--r--etc/rc.sendmail193
-rw-r--r--etc/sendmail/Makefile2
-rw-r--r--etc/sendmail/rc.sendmail193
-rw-r--r--share/man/man5/rc.conf.5118
-rw-r--r--share/man/man8/Makefile4
-rw-r--r--share/man/man8/rc.sendmail.8241
9 files changed, 706 insertions, 222 deletions
diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf
index 32bf9b3..b25d6ac 100644
--- a/etc/defaults/rc.conf
+++ b/etc/defaults/rc.conf
@@ -324,17 +324,12 @@ allscreens_kbdflags="" # Set this kbdcontrol mode for all virtual screens
##############################################################
-### Miscellaneous administrative options ###################
+### Mail Transfer Agent (MTA) options ######################
##############################################################
-cron_enable="YES" # Run the periodic job daemon.
-cron_program="/usr/sbin/cron" # Which cron executable to run (if enabled).
-cron_flags="" # Which options to pass to the cron daemon.
-lpd_enable="NO" # Run the line printer daemon.
-lpd_program="/usr/sbin/lpd" # path to lpd, if you want a different one.
-lpd_flags="" # Flags to lpd (if enabled).
-usbd_enable="NO" # Run the usbd daemon.
-usbd_flags="" # Flags to usbd (if enabled).
+mta_start_script="/etc/rc.sendmail"
+ # Script to start your chosen MTA, called by /etc/rc.
+# Settings for /etc/rc.sendmail:
sendmail_enable="NO" # Run the sendmail inbound daemon (YES/NO/NONE).
# If NONE, don't start any sendmail processes.
sendmail_flags="-L sm-mta -bd -q30m" # Flags to sendmail (as a server)
@@ -346,6 +341,20 @@ sendmail_outbound_flags="-L sm-queue -q30m" # Flags to sendmail (outbound only)
sendmail_msp_queue_enable="YES" # Dequeue stuck clientmqueue mail (YES/NO).
sendmail_msp_queue_flags="-L sm-msp-queue -Ac -q30m"
# Flags for sendmail_msp_queue daemon.
+
+
+##############################################################
+### Miscellaneous administrative options ###################
+##############################################################
+
+cron_enable="YES" # Run the periodic job daemon.
+cron_program="/usr/sbin/cron" # Which cron executable to run (if enabled).
+cron_flags="" # Which options to pass to the cron daemon.
+lpd_enable="NO" # Run the line printer daemon.
+lpd_program="/usr/sbin/lpd" # path to lpd, if you want a different one.
+lpd_flags="" # Flags to lpd (if enabled).
+usbd_enable="NO" # Run the usbd daemon.
+usbd_flags="" # Flags to usbd (if enabled).
dumpdev="NO" # Device name to crashdump to (or NO).
dumpdir="/var/crash" # Directory where crash dumps are to be stored
savecore_flags="" # Used if dumpdev is enabled above, and present.
diff --git a/etc/mail/Makefile b/etc/mail/Makefile
index b92f6b3..238b906 100644
--- a/etc/mail/Makefile
+++ b/etc/mail/Makefile
@@ -12,13 +12,22 @@
# aliases - Build the sendmail aliases
# install - Install the .cf file as /etc/mail/sendmail.cf
#
-# For the MTA daemon:
-# start - Start the sendmail daemon with the flags defined in
-# /etc/defaults/rc.conf or /etc/rc.conf
-# stop - Stop the sendmail daemon
-# restart - Restart the sendmail daemon
-#
-# For the MSP queue running daemon:
+# For acting on both the MTA daemon and MSP queue running daemon:
+# start - Start both the sendmail MTA daemon and MSP queue running
+# daemon with the flags defined in /etc/defaults/rc.conf or
+# /etc/rc.conf
+# stop - Stop both the sendmail MTA daemon and MSP queue running
+# daemon
+# restart - Restart both the sendmail MTA daemon and MSP queue running
+# daemon
+#
+# For acting on just the MTA daemon:
+# start-mta - Start the sendmail MTA daemon with the flags defined in
+# /etc/defaults/rc.conf or /etc/rc.conf
+# stop-mta - Stop the sendmail MTA daemon
+# restart-mta - Restart the sendmail MTA daemon
+#
+# For acting on just the MSP queue running daemon:
# start-mspq - Start the sendmail MSP queue running daemon with the
# flags defined in /etc/defaults/rc.conf or /etc/rc.conf
# stop-mspq - Stop the sendmail MSP queue running daemon
@@ -70,10 +79,9 @@ SENDMAIL_CF_DIR?= /usr/src/contrib/sendmail/cf
.endif
#
-# The pid is used to stop and restart the running daemon.
+# The sendmail startup script
#
-SENDMAIL_PIDFILE?= /var/run/sendmail.pid
-SENDMAIL_MSPQ_PIDFILE?= /var/spool/clientmqueue/sm-client.pid
+SENDMAIL_START_SCRIPT?= /etc/rc.sendmail
#
# Some useful programs we need.
@@ -81,7 +89,6 @@ SENDMAIL_MSPQ_PIDFILE?= /var/spool/clientmqueue/sm-client.pid
SENDMAIL?= /usr/sbin/sendmail
MAKEMAP?= /usr/sbin/makemap
M4?= /usr/bin/m4
-KILL?= /bin/kill
# Set a reasonable default
.MAIN: all
@@ -172,65 +179,26 @@ install: ${INSTALL_CF}
${INSTALL} -c -m ${SHAREMODE} ${INSTALL_CF} /etc/mail/sendmail.cf
.endif
-start:
- @(. /etc/defaults/rc.conf; source_rc_confs; \
- case "$${sendmail_enable}" in \
- [Nn][Oo][Nn][Ee]) \
- echo "ERROR: sendmail_enable is set to $${sendmail_enable}" \
- ;; \
- [Yy][Ee][Ss]) \
- ${SENDMAIL} $${sendmail_flags}; \
- echo "${SENDMAIL} $${sendmail_flags}" \
- ;; \
- *) \
- case "$${sendmail_submit_enable}" in \
- [Yy][Ee][Ss]) \
- ${SENDMAIL} $${sendmail_submit_flags}; \
- echo "${SENDMAIL} $${sendmail_submit_flags}" \
- ;; \
- *) \
- case "$${sendmail_outbound_enable}" in \
- [Yy][Ee][Ss]) \
- ${SENDMAIL} $${sendmail_outbound_flags}; \
- echo "${SENDMAIL} $${sendmail_outbound_flags}" \
- ;; \
- esac \
- ;; \
- esac \
- ;; \
- esac \
- )
-
-stop:
- ${KILL} -TERM `head -1 ${SENDMAIL_PIDFILE}`
-
-restart:
- ${KILL} -HUP `head -1 ${SENDMAIL_PIDFILE}`
-
-start-mspq:
- @(. /etc/defaults/rc.conf; source_rc_confs; \
- case "$${sendmail_enable}" in \
- [Nn][Oo][Nn][Ee]) \
- echo "ERROR: sendmail_enable is set to $${sendmail_enable}" \
- ;; \
- *) \
- if [ -r /etc/mail/submit.cf ]; then \
- case "$${sendmail_msp_queue_enable}" in \
- [Yy][Ee][Ss]) \
- ${SENDMAIL} $${sendmail_msp_queue_flags}; \
- echo "${SENDMAIL} $${sendmail_msp_queue_flags}" \
- ;; \
- esac \
- fi \
- ;; \
- esac \
- )
-
-stop-mspq:
- ${KILL} -TERM `head -1 ${SENDMAIL_MSPQ_PIDFILE}`
-
-restart-mspq:
- ${KILL} -HUP `head -1 ${SENDMAIL_MSPQ_PIDFILE}`
+start start-mta start-mspq:
+ @if [ -r ${SENDMAIL_START_SCRIPT} ]; then \
+ echo -n 'Starting:'; \
+ sh ${SENDMAIL_START_SCRIPT} $@; \
+ echo '.'; \
+ fi
+
+stop stop-mta stop-mspq:
+ @if [ -r ${SENDMAIL_START_SCRIPT} ]; then \
+ echo -n 'Stopping:'; \
+ sh ${SENDMAIL_START_SCRIPT} $@; \
+ echo '.'; \
+ fi
+
+restart restart-mta restart-mspq:
+ @if [ -r ${SENDMAIL_START_SCRIPT} ]; then \
+ echo -n 'Restarting:'; \
+ sh ${SENDMAIL_START_SCRIPT} $@; \
+ echo '.'; \
+ fi
# User defined targets
.if exists(Makefile.local)
diff --git a/etc/rc b/etc/rc
index 1ac04b2..422e523 100644
--- a/etc/rc
+++ b/etc/rc
@@ -702,44 +702,10 @@ case ${usbd_enable} in
;;
esac
-# Note: Please keep the sendmail startup code here in sync with the code
-# in src/etc/mail/Makefile.
-case ${sendmail_enable} in
-[Nn][Oo][Nn][Ee])
- ;;
-[Yy][Ee][Ss])
- echo -n ' sendmail'
- /usr/sbin/sendmail ${sendmail_flags}
- ;;
-*)
- case ${sendmail_submit_enable} in
- [Yy][Ee][Ss])
- echo -n ' sendmail-submit'
- /usr/sbin/sendmail ${sendmail_submit_flags}
- ;;
- *)
- case ${sendmail_outbound_enable} in
- [Yy][Ee][Ss])
- echo -n ' sendmail-outbound'
- /usr/sbin/sendmail ${sendmail_outbound_flags}
- ;;
- esac
- ;;
- esac
- ;;
-esac
-
-case ${sendmail_enable} in
-[Nn][Oo][Nn][Ee])
- ;;
-*)
- if [ -r /etc/mail/submit.cf ]; then
- case ${sendmail_msp_queue_enable} in
- [Yy][Ee][Ss])
- echo -n ' sendmail-clientmqueue'
- /usr/sbin/sendmail ${sendmail_msp_queue_flags}
- ;;
- esac
+case ${mta_start_script} in
+/*)
+ if [ -r ${mta_start_script} ]; then
+ sh ${mta_start_script}
fi
;;
esac
diff --git a/etc/rc.sendmail b/etc/rc.sendmail
new file mode 100644
index 0000000..0a79f91
--- /dev/null
+++ b/etc/rc.sendmail
@@ -0,0 +1,193 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2000, 2002 The FreeBSD Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# This script is used by /etc/rc at boot time to start sendmail. It
+# is meant to be sendmail specific and not a generic script for all
+# MTAs. It is only called by /etc/rc if the rc.conf mta_start_script is
+# set to /etc/rc.sendmail. This provides the opportunity for other MTAs
+# to provide their own startup script.
+
+# The script is also used by /etc/mail/Makefile to enable the
+# start/stop/restart targets.
+
+# The source for the script can be found in src/etc/sendmail/rc.sendmail.
+
+if [ -r /etc/defaults/rc.conf ]; then
+ . /etc/defaults/rc.conf
+ source_rc_confs
+elif [ -r /etc/rc.conf ]; then
+ . /etc/rc.conf
+fi
+
+# The sendmail binary
+sendmail_program=${sendmail_program:-/usr/sbin/sendmail}
+
+# The pid is used to stop and restart the running daemon(s).
+sendmail_pidfile=${sendmail_pidfile:-/var/run/sendmail.pid}
+sendmail_mspq_pidfile=${sendmail_mspq_pidfile:-/var/spool/clientmqueue/sm-client.pid}
+
+start_mta()
+{
+ case ${sendmail_enable} in
+ [Nn][Oo][Nn][Ee])
+ ;;
+ [Yy][Ee][Ss])
+ echo -n ' sendmail'
+ ${sendmail_program} ${sendmail_flags}
+ ;;
+ *)
+ case ${sendmail_submit_enable} in
+ [Yy][Ee][Ss])
+ echo -n ' sendmail-submit'
+ ${sendmail_program} ${sendmail_submit_flags}
+ ;;
+ *)
+ case ${sendmail_outbound_enable} in
+ [Yy][Ee][Ss])
+ echo -n ' sendmail-outbound'
+ ${sendmail_program} ${sendmail_outbound_flags}
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+}
+
+stop_mta()
+{
+ if [ -r ${sendmail_pidfile} ]; then
+ echo -n ' sendmail'
+ kill -TERM `head -1 ${sendmail_pidfile}`
+ else
+ echo "$0: stop-mta: ${sendmail_pidfile} not found"
+ fi
+}
+
+restart_mta()
+{
+ if [ -r ${sendmail_pidfile} ]; then
+ echo -n ' sendmail'
+ kill -HUP `head -1 ${sendmail_pidfile}`
+ else
+ echo "$0: restart-mta: ${sendmail_pidfile} not found"
+ fi
+}
+
+start_mspq()
+{
+ case ${sendmail_enable} in
+ [Nn][Oo][Nn][Ee])
+ ;;
+ *)
+ if [ -r /etc/mail/submit.cf ]; then
+ case ${sendmail_msp_queue_enable} in
+ [Yy][Ee][Ss])
+ echo -n ' sendmail-clientmqueue'
+ ${sendmail_program} ${sendmail_msp_queue_flags}
+ ;;
+ esac
+ fi
+ ;;
+ esac
+}
+
+stop_mspq()
+{
+ if [ -r ${sendmail_mspq_pidfile} ]; then
+ echo -n ' sendmail-clientmqueue'
+ kill -TERM `head -1 ${sendmail_mspq_pidfile}`
+ else
+ echo "$0: stop-mspq: ${sendmail_mspq_pidfile} not found"
+ fi
+}
+
+restart_mspq()
+{
+ if [ -r ${sendmail_mspq_pidfile} ]; then
+ echo -n ' sendmail-clientmqueue'
+ kill -HUP `head -1 ${sendmail_mspq_pidfile}`
+ else
+ echo "$0: restart-mspq: ${sendmail_mspq_pidfile} not found"
+ fi
+}
+
+# If no argument is given, assume we are being called at boot time.
+_action=${1:-start}
+
+case ${_action} in
+start)
+ start_mta
+ start_mspq
+ ;;
+
+stop)
+ stop_mta
+ stop_mspq
+ ;;
+
+restart)
+ restart_mta
+ restart_mspq
+ ;;
+
+start-mta)
+ start_mta
+ ;;
+
+stop-mta)
+ stop_mta
+ ;;
+
+restart-mta)
+ restart_mta
+ ;;
+
+start-mspq)
+ start_mspq
+ ;;
+
+stop-mspq)
+ stop_mspq
+ ;;
+
+restart-mspq)
+ restart_mspq
+ ;;
+
+*)
+ echo "Usage: `basename $0` {start|stop|restart}" >&2
+ echo " `basename $0` {start-mta|stop-mta|restart-mta}" >&2
+ echo " `basename $0` {start-mspq|stop-mspq|restart-mspq}" >&2
+ exit 64
+ ;;
+
+esac
+exit 0
diff --git a/etc/sendmail/Makefile b/etc/sendmail/Makefile
index dd87e16..3a39a1c 100644
--- a/etc/sendmail/Makefile
+++ b/etc/sendmail/Makefile
@@ -82,6 +82,8 @@ distribution: freebsd.cf freebsd.mc ${INSTALL_CF}
@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
@false
.endif
+ ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/rc.sendmail \
+ ${DESTDIR}/etc
${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/freebsd.mc \
${DESTDIR}/etc/mail/freebsd.mc
${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
diff --git a/etc/sendmail/rc.sendmail b/etc/sendmail/rc.sendmail
new file mode 100644
index 0000000..0a79f91
--- /dev/null
+++ b/etc/sendmail/rc.sendmail
@@ -0,0 +1,193 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2000, 2002 The FreeBSD Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# This script is used by /etc/rc at boot time to start sendmail. It
+# is meant to be sendmail specific and not a generic script for all
+# MTAs. It is only called by /etc/rc if the rc.conf mta_start_script is
+# set to /etc/rc.sendmail. This provides the opportunity for other MTAs
+# to provide their own startup script.
+
+# The script is also used by /etc/mail/Makefile to enable the
+# start/stop/restart targets.
+
+# The source for the script can be found in src/etc/sendmail/rc.sendmail.
+
+if [ -r /etc/defaults/rc.conf ]; then
+ . /etc/defaults/rc.conf
+ source_rc_confs
+elif [ -r /etc/rc.conf ]; then
+ . /etc/rc.conf
+fi
+
+# The sendmail binary
+sendmail_program=${sendmail_program:-/usr/sbin/sendmail}
+
+# The pid is used to stop and restart the running daemon(s).
+sendmail_pidfile=${sendmail_pidfile:-/var/run/sendmail.pid}
+sendmail_mspq_pidfile=${sendmail_mspq_pidfile:-/var/spool/clientmqueue/sm-client.pid}
+
+start_mta()
+{
+ case ${sendmail_enable} in
+ [Nn][Oo][Nn][Ee])
+ ;;
+ [Yy][Ee][Ss])
+ echo -n ' sendmail'
+ ${sendmail_program} ${sendmail_flags}
+ ;;
+ *)
+ case ${sendmail_submit_enable} in
+ [Yy][Ee][Ss])
+ echo -n ' sendmail-submit'
+ ${sendmail_program} ${sendmail_submit_flags}
+ ;;
+ *)
+ case ${sendmail_outbound_enable} in
+ [Yy][Ee][Ss])
+ echo -n ' sendmail-outbound'
+ ${sendmail_program} ${sendmail_outbound_flags}
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+}
+
+stop_mta()
+{
+ if [ -r ${sendmail_pidfile} ]; then
+ echo -n ' sendmail'
+ kill -TERM `head -1 ${sendmail_pidfile}`
+ else
+ echo "$0: stop-mta: ${sendmail_pidfile} not found"
+ fi
+}
+
+restart_mta()
+{
+ if [ -r ${sendmail_pidfile} ]; then
+ echo -n ' sendmail'
+ kill -HUP `head -1 ${sendmail_pidfile}`
+ else
+ echo "$0: restart-mta: ${sendmail_pidfile} not found"
+ fi
+}
+
+start_mspq()
+{
+ case ${sendmail_enable} in
+ [Nn][Oo][Nn][Ee])
+ ;;
+ *)
+ if [ -r /etc/mail/submit.cf ]; then
+ case ${sendmail_msp_queue_enable} in
+ [Yy][Ee][Ss])
+ echo -n ' sendmail-clientmqueue'
+ ${sendmail_program} ${sendmail_msp_queue_flags}
+ ;;
+ esac
+ fi
+ ;;
+ esac
+}
+
+stop_mspq()
+{
+ if [ -r ${sendmail_mspq_pidfile} ]; then
+ echo -n ' sendmail-clientmqueue'
+ kill -TERM `head -1 ${sendmail_mspq_pidfile}`
+ else
+ echo "$0: stop-mspq: ${sendmail_mspq_pidfile} not found"
+ fi
+}
+
+restart_mspq()
+{
+ if [ -r ${sendmail_mspq_pidfile} ]; then
+ echo -n ' sendmail-clientmqueue'
+ kill -HUP `head -1 ${sendmail_mspq_pidfile}`
+ else
+ echo "$0: restart-mspq: ${sendmail_mspq_pidfile} not found"
+ fi
+}
+
+# If no argument is given, assume we are being called at boot time.
+_action=${1:-start}
+
+case ${_action} in
+start)
+ start_mta
+ start_mspq
+ ;;
+
+stop)
+ stop_mta
+ stop_mspq
+ ;;
+
+restart)
+ restart_mta
+ restart_mspq
+ ;;
+
+start-mta)
+ start_mta
+ ;;
+
+stop-mta)
+ stop_mta
+ ;;
+
+restart-mta)
+ restart_mta
+ ;;
+
+start-mspq)
+ start_mspq
+ ;;
+
+stop-mspq)
+ stop_mspq
+ ;;
+
+restart-mspq)
+ restart_mspq
+ ;;
+
+*)
+ echo "Usage: `basename $0` {start|stop|restart}" >&2
+ echo " `basename $0` {start-mta|stop-mta|restart-mta}" >&2
+ echo " `basename $0` {start-mspq|stop-mspq|restart-mspq}" >&2
+ exit 64
+ ;;
+
+esac
+exit 0
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index 4deefd0..a579552 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -1716,111 +1716,19 @@ is set to
these are the flags to pass to the
.Xr lpd 8
daemon.
-.It Va sendmail_enable
+.It Va mta_start_script
.Pq Vt str
-If set to
-.Dq Li YES ,
-run the
-.Xr sendmail 8
-daemon at system boot time.
-If set to
-.Dq Li NONE ,
-do not run any
-.Xr sendmail 8
-daemons at system boot time.
-.It Va sendmail_flags
-.Pq Vt str
-If
-.Va sendmail_enable
-is set to
-.Dq Li YES ,
-these are the flags to pass to the
-.Xr sendmail 8
-daemon.
-.It Va sendmail_submit_enable
-.Pq Vt bool
-If set to
-.Dq Li YES
-and
-.Va sendmail_enable
-is set to
-.Dq Li NO ,
-run
-.Xr sendmail 8
-using
-.Va sendmail_submit_flags
-instead of
-.Va sendmail_flags .
-This is intended to allow local mail submission via
-a localhost-only listening SMTP service required for running
-.Xr sendmail 8
-as a non-set-user-ID binary.
-.It Va sendmail_submit_flags
-.Pq Vt str
-If
-.Va sendmail_enable
-is set to
-.Dq Li NO
-and
-.Va sendmail_submit_enable
-is set to
-.Dq Li YES ,
-these are the flags to pass to the
-.Xr sendmail 8
-daemon.
-.It Va sendmail_outbound_enable
-.Pq Vt bool
-If set to
-.Dq Li YES
-and both
-.Va sendmail_enable
-and
-.Va sendmail_submit_enable
-are set to
-.Dq Li NO ,
-run
-.Xr sendmail 8
-using
-.Va sendmail_outbound_flags
-instead of
-.Va sendmail_flags .
-This is intended to allow local mail queue management
-for systems that do not offer a listening SMTP service.
-.It Va sendmail_outbound_flags
-.Pq Vt str
-If both
-.Va sendmail_enable
-and
-.Va sendmail_submit_enable
-are set to
-.Dq Li NO
-and
-.Va sendmail_outbound_enable
-is set to
-.Dq Li YES ,
-these are the flags to pass to the
-.Xr sendmail 8
-daemon.
-.It Va sendmail_msp_queue_enable
-.Pq Vt bool
-If set to
-.Dq Li YES ,
-start a client (MSP) queue runner
-.Xr sendmail 8
-daemon at system boot time.
-As of sendmail 8.12, a separate queue is used for command line
-submissions.
-The client queue runner assures that nothing is
-left behind in the submission queue.
-.It Va sendmail_msp_queue_flags
-.Pq Vt str
-If
-.Va sendmail_msp_queue_enable
-is set to
-.Dq Li YES ,
-these are the flags to pass to the
-.Xr sendmail 8
-daemon.
+This variable specifies the full path to the script to run to start
+a mail transfer agent.
+The default is
+.Pa /etc/rc.sendmail .
+The
+.Va sendmail_*
+variables which
+.Pa /etc/rc.sendmail
+uses are documented in the
+.Xr rc.sendmail 8
+man page.
.It Va dumpdev
.Pq Vt str
Indicates the device (usually a swap partition) to which a crash dump
@@ -2091,6 +1999,7 @@ Flags for
.Xr quotacheck 8 ,
.Xr quotaon 8 ,
.Xr rc 8 ,
+.Xr rc.sendmail 8 ,
.Xr route 8 ,
.Xr routed 8 ,
.Xr rpc.lockd 8 ,
@@ -2098,7 +2007,6 @@ Flags for
.Xr rpcbind 8 ,
.Xr rwhod 8 ,
.Xr savecore 8 ,
-.Xr sendmail 8 ,
.Xr sshd 8 ,
.Xr swapon 8 ,
.Xr sysctl 8 ,
diff --git a/share/man/man8/Makefile b/share/man/man8/Makefile
index 505443f..f509733 100644
--- a/share/man/man8/Makefile
+++ b/share/man/man8/Makefile
@@ -10,6 +10,10 @@ MAN= adding_user.8 \
sticky.8 \
yp.8
+.if !defined(NO_SENDMAIL)
+MAN+= rc.sendmail.8
+.endif
+
MLINKS= rc.8 rc.early.8 rc.8 rc.serial.8 rc.8 rc.pccard.8 rc.8 rc.network.8
MLINKS+=rc.8 rc.firewall.8 rc.8 rc.atm.8 rc.8 rc.local.8 rc.8 rc.shutdown.8
MLINKS+=yp.8 YP.8 yp.8 NIS.8 yp.8 nis.8
diff --git a/share/man/man8/rc.sendmail.8 b/share/man/man8/rc.sendmail.8
new file mode 100644
index 0000000..86783d4
--- /dev/null
+++ b/share/man/man8/rc.sendmail.8
@@ -0,0 +1,241 @@
+.\" Copyright (c) 1995
+.\" Jordan K. Hubbard
+.\" Copyright (c) 2002 The FreeBSD Project
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 30, 2002
+.Dt RC.SENDMAIL 8
+.Os
+.Sh NAME
+.Nm rc.sendmail
+.Nd
+.Xr sendmail 8
+startup script
+.Sh DESCRIPTION
+The
+.Nm
+script is used by
+.Pa /etc/rc
+at boot time to start
+.Xr sendmail 8 .
+It is meant to be
+.Xr sendmail 8
+specific and not a generic script for all MTAs.
+It is only called by
+.Pa /etc/rc
+if the
+.Xr rc.conf 5
+.Va mta_start_script
+variable is set to
+.Pa /etc/rc.sendmail .
+.Pp
+The
+.Nm
+script can take an optional argument specifying the action to
+perform.
+The available actions are:
+.Bl -tag -width ".Cm restart-mspq"
+.It Cm start
+Starts both the MTA and the MSP queue runner.
+.It Cm stop
+Stops both the MTA and the MSP queue runner.
+.It Cm restart
+Restarts both the MTA and the MSP queue runner.
+.It Cm start-mta
+Starts just the MTA.
+.It Cm stop-mta
+Stops just the MTA.
+.It Cm restart-mta
+Restarts just the MTA.
+.It Cm start-mspq
+Starts just the MSP queue runner.
+.It Cm stop-mspq
+Stops just the MSP queue runner.
+.It Cm restart-mspq
+Restarts just the MSP queue runner.
+.El
+.Pp
+If no action is specified,
+.Cm start
+is assumed.
+.Pp
+The
+.Nm
+script is also used by
+.Pa /etc/mail/Makefile
+to enable the
+.Pa Makefile Ns 's
+.Cm start , stop ,
+and
+.Cm restart
+targets.
+.Sh RC.CONF VARIABLES
+The following variables effect the behavior of
+.Nm .
+They are defined in
+.Pa /etc/defaults/rc.conf
+and can be changed in
+.Pa /etc/rc.conf .
+.Bl -tag -width indent
+.It Va sendmail_enable
+.Pq Vt str
+If set to
+.Dq Li YES ,
+run the
+.Xr sendmail 8
+daemon at system boot time.
+If set to
+.Dq Li NONE ,
+do not run any
+.Xr sendmail 8
+daemons at system boot time.
+.It Va sendmail_flags
+.Pq Vt str
+If
+.Va sendmail_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr sendmail 8
+daemon.
+.It Va sendmail_submit_enable
+.Pq Vt bool
+If set to
+.Dq Li YES
+and
+.Va sendmail_enable
+is set to
+.Dq Li NO ,
+run
+.Xr sendmail 8
+using
+.Va sendmail_submit_flags
+instead of
+.Va sendmail_flags .
+This is intended to allow local mail submission via
+a localhost-only listening SMTP service required for running
+.Xr sendmail 8
+as a non-set-user-ID binary.
+.It Va sendmail_submit_flags
+.Pq Vt str
+If
+.Va sendmail_enable
+is set to
+.Dq Li NO
+and
+.Va sendmail_submit_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr sendmail 8
+daemon.
+.It Va sendmail_outbound_enable
+.Pq Vt bool
+If set to
+.Dq Li YES
+and both
+.Va sendmail_enable
+and
+.Va sendmail_submit_enable
+are set to
+.Dq Li NO ,
+run
+.Xr sendmail 8
+using
+.Va sendmail_outbound_flags
+instead of
+.Va sendmail_flags .
+This is intended to allow local mail queue management
+for systems that do not offer a listening SMTP service.
+.It Va sendmail_outbound_flags
+.Pq Vt str
+If both
+.Va sendmail_enable
+and
+.Va sendmail_submit_enable
+are set to
+.Dq Li NO
+and
+.Va sendmail_outbound_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr sendmail 8
+daemon.
+.It Va sendmail_msp_queue_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+start a client (MSP) queue runner
+.Xr sendmail 8
+daemon at system boot time.
+As of sendmail 8.12, a separate queue is used for command line
+submissions.
+The client queue runner assures that nothing is
+left behind in the submission queue.
+.It Va sendmail_msp_queue_flags
+.Pq Vt str
+If
+.Va sendmail_msp_queue_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr sendmail 8
+daemon.
+.El
+.Pp
+These variables are used to determine how the
+.Xr sendmail 8
+daemons are started:
+.Pp
+.Bd -literal -offset indent
+# MTA
+if (${sendmail_enable} == NONE)
+ # Do nothing
+else if (${sendmail_enable} == YES)
+ start sendmail with ${sendmail_flags}
+else if (${sendmail_submit_enable} == YES)
+ start sendmail with ${sendmail_submit_flags}
+else if (${sendmail_outbound_enable} == YES)
+ start sendmail with ${sendmail_outbound_flags}
+endif
+
+# MSP Queue Runner
+if (${sendmail_enable} != NONE &&
+ [ -r /etc/mail/submit.cf] &&
+ ${sendmail_msp_queue_enable} == YES)
+ start sendmail with ${sendmail_msp_queue_flags}
+endif
+.Ed
+.Sh SEE ALSO
+.Xr rc.conf 5 ,
+.Xr rc 8 ,
+.Xr sendmail 8
+.Sh HISTORY
+The
+.Nm
+file appeared in
+.Fx 4.6 .
OpenPOWER on IntegriCloud