aboutsummaryrefslogtreecommitdiff
path: root/etc/mail
diff options
context:
space:
mode:
authorGregory Neil Shapiro <gshapiro@FreeBSD.org>2002-04-05 02:30:49 +0000
committerGregory Neil Shapiro <gshapiro@FreeBSD.org>2002-04-05 02:30:49 +0000
commit619b80c4e66179b83f0b53ba06261919939a8aa1 (patch)
tree2f224401e91686cb1b50b4d91085277cadcdf2b4 /etc/mail
parent911fc92344b6bf19e1d34124ab70a040009051fa (diff)
downloadsrc-619b80c4e66179b83f0b53ba06261919939a8aa1.tar.gz
src-619b80c4e66179b83f0b53ba06261919939a8aa1.zip
Quoting Peter Wemm, "At great personal risk, touch the sendmail startup
again." As an alternative to sendmail_enable=NONE, solve the boot time problem for non-sendmail users completely by moving all of the sendmail startup code from /etc/rc to /etc/rc.sendmail. The source for that script will be kept in src/etc/sendmail/rc.sendmail so make.conf's NO_SENDMAIL will prevent it from being installed. A new rc.conf variable, mta_start_script specifies the script to run to start the user's preferred MTA. For backward compatibility, it will default to /etc/rc.sendmail. The specified script is called out of /etc/rc after checking to make sure it exists. A new rc.sendmail.8 man page has also been added which now houses the sendmail_* variable descriptions formerly in rc.conf.5. Use /etc/rc.sendmail in /etc/mail/Makefile to reduce code duplication. Reviewed by: -current, -stable, obrien, peter, ru MFC after: 1 week
Notes
Notes: svn path=/head/; revision=93853
Diffstat (limited to 'etc/mail')
-rw-r--r--etc/mail/Makefile108
1 files changed, 38 insertions, 70 deletions
diff --git a/etc/mail/Makefile b/etc/mail/Makefile
index b92f6b3af3a9..238b906ba701 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)