remove unused code
[freebsd-src/fkvm-freebsd.git] / etc / rc.sendmail
blobb025bc0bd62cbb5630c9c67908b9b9e6fb1380ba
1 #!/bin/sh
4 # Copyright (c) 2002 Gregory Neil Shapiro. All Rights Reserved.
5 # Copyright (c) 2000, 2002 The FreeBSD Project
6 # All rights reserved.
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
10 # are met:
11 # 1. Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # 2. Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
17 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 # SUCH DAMAGE.
29 # $FreeBSD$
32 # This script is used by /etc/rc at boot time to start sendmail. It
33 # is meant to be sendmail specific and not a generic script for all
34 # MTAs. It is only called by /etc/rc if the rc.conf mta_start_script is
35 # set to /etc/rc.sendmail. This provides the opportunity for other MTAs
36 # to provide their own startup script.
38 # The script is also used by /etc/mail/Makefile to enable the
39 # start/stop/restart targets.
41 # The source for the script can be found in src/etc/sendmail/rc.sendmail.
43 if [ -r /etc/defaults/rc.conf ]; then
44 . /etc/defaults/rc.conf
45 source_rc_confs
46 elif [ -r /etc/rc.conf ]; then
47 . /etc/rc.conf
50 # The sendmail binary
51 sendmail_program=${sendmail_program:-/usr/sbin/sendmail}
53 # The pid is used to stop and restart the running daemon(s).
54 sendmail_pidfile=${sendmail_pidfile:-/var/run/sendmail.pid}
55 sendmail_mspq_pidfile=${sendmail_mspq_pidfile:-/var/spool/clientmqueue/sm-client.pid}
57 start_mta()
59 case ${sendmail_enable} in
60 [Nn][Oo][Nn][Ee])
62 [Yy][Ee][Ss])
63 echo -n ' sendmail'
64 ${sendmail_program} ${sendmail_flags}
67 case ${sendmail_submit_enable} in
68 [Yy][Ee][Ss])
69 echo -n ' sendmail-submit'
70 ${sendmail_program} ${sendmail_submit_flags}
73 case ${sendmail_outbound_enable} in
74 [Yy][Ee][Ss])
75 echo -n ' sendmail-outbound'
76 ${sendmail_program} ${sendmail_outbound_flags}
78 esac
80 esac
82 esac
85 stop_mta()
87 # Check to make sure we are configured to start an MTA
88 case ${sendmail_enable} in
89 [Nn][Oo][Nn][Ee])
90 return
92 [Yy][Ee][Ss])
95 case ${sendmail_submit_enable} in
96 [Yy][Ee][Ss])
99 case ${sendmail_outbound_enable} in
100 [Yy][Ee][Ss])
103 return
105 esac
107 esac
109 esac
111 if [ -r ${sendmail_pidfile} ]; then
112 echo -n ' sendmail'
113 kill -TERM `head -1 ${sendmail_pidfile}`
114 else
115 echo "$0: stop-mta: ${sendmail_pidfile} not found"
119 restart_mta()
121 # Check to make sure we are configured to start an MTA
122 case ${sendmail_enable} in
123 [Nn][Oo][Nn][Ee])
124 return
126 [Yy][Ee][Ss])
129 case ${sendmail_submit_enable} in
130 [Yy][Ee][Ss])
133 case ${sendmail_outbound_enable} in
134 [Yy][Ee][Ss])
137 return
139 esac
141 esac
143 esac
144 if [ -r ${sendmail_pidfile} ]; then
145 echo -n ' sendmail'
146 kill -HUP `head -1 ${sendmail_pidfile}`
147 else
148 echo "$0: restart-mta: ${sendmail_pidfile} not found"
152 start_mspq()
154 case ${sendmail_enable} in
155 [Nn][Oo][Nn][Ee])
158 if [ -r /etc/mail/submit.cf ]; then
159 case ${sendmail_msp_queue_enable} in
160 [Yy][Ee][Ss])
161 echo -n ' sendmail-clientmqueue'
162 ${sendmail_program} ${sendmail_msp_queue_flags}
164 esac
167 esac
170 stop_mspq()
172 # Check to make sure we are configured to start an MSP queue runner
173 case ${sendmail_enable} in
174 [Nn][Oo][Nn][Ee])
175 return
178 if [ -r /etc/mail/submit.cf ]; then
179 case ${sendmail_msp_queue_enable} in
180 [Yy][Ee][Ss])
183 return
185 esac
188 esac
190 if [ -r ${sendmail_mspq_pidfile} ]; then
191 echo -n ' sendmail-clientmqueue'
192 kill -TERM `head -1 ${sendmail_mspq_pidfile}`
193 else
194 echo "$0: stop-mspq: ${sendmail_mspq_pidfile} not found"
198 restart_mspq()
200 # Check to make sure we are configured to start an MSP queue runner
201 case ${sendmail_enable} in
202 [Nn][Oo][Nn][Ee])
203 return
206 if [ -r /etc/mail/submit.cf ]; then
207 case ${sendmail_msp_queue_enable} in
208 [Yy][Ee][Ss])
211 return
213 esac
216 esac
218 if [ -r ${sendmail_mspq_pidfile} ]; then
219 echo -n ' sendmail-clientmqueue'
220 kill -HUP `head -1 ${sendmail_mspq_pidfile}`
221 else
222 echo "$0: restart-mspq: ${sendmail_mspq_pidfile} not found"
226 # If no argument is given, assume we are being called at boot time.
227 _action=${1:-start}
229 case ${_action} in
230 start)
231 start_mta
232 start_mspq
235 stop)
236 stop_mta
237 stop_mspq
240 restart)
241 restart_mta
242 restart_mspq
245 start-mta)
246 start_mta
249 stop-mta)
250 stop_mta
253 restart-mta)
254 restart_mta
257 start-mspq)
258 start_mspq
261 stop-mspq)
262 stop_mspq
265 restart-mspq)
266 restart_mspq
270 echo "usage: `basename $0` {start|stop|restart}" >&2
271 echo " `basename $0` {start-mta|stop-mta|restart-mta}" >&2
272 echo " `basename $0` {start-mspq|stop-mspq|restart-mspq}" >&2
273 exit 64
276 esac
277 exit 0