5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
22 # Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
24 .
/lib
/svc
/share
/smf_include.sh
25 .
/lib
/svc
/share
/sendmail_include.sh
27 CLIENT_PID_FILE
="/var/spool/clientmqueue/sm-client.pid"
28 SUBMIT_CF
="/etc/mail/submit.cf"
32 [ -f $CLIENT_PID_FILE ] && kill -1 `head -1 $CLIENT_PID_FILE`
36 exist_or_exit
$SENDMAIL
37 [ -f $DEFAULT_FILE ] && .
$DEFAULT_FILE
39 # * CLIENTQUEUEINTERVAL should be set to some legal value;
40 # sanity checks are done below.
41 # * CLIENTOPTIONS are catch-alls; set with care.
43 check_queue_interval_syntax
$CLIENTQUEUEINTERVAL
44 CLIENTQUEUEINTERVAL
=$answer
46 submit_path
=`svcprop -p config/path_to_submit_mc $SMF_FMRI 2>/dev/null`
47 if [ $?
-eq 0 -a -n "$submit_path" ]; then
48 turn_m4_crank
"$SUBMIT_CF" "$submit_path"
50 exist_or_exit
"$SUBMIT_CF"
52 $SENDMAIL -Ac -q$CLIENTQUEUEINTERVAL $CLIENTOPTIONS &
56 if [ -f $CLIENT_PID_FILE ]; then
57 check_and_kill
$CLIENT_PID_FILE
58 rm -f $CLIENT_PID_FILE
60 # Need to kill the entire service contract to kill all sendmail related
62 smf_kill_contract
$2 TERM
1 30
64 [ $ret -eq 1 ] && exit 1
66 # Sendmail can take its time responding to SIGTERM, as it waits for
67 # things like child processes and SMTP connections to clean up. If
68 # the contract did not empty after TERM, move on to KILL.
69 if [ $ret -eq 2 ] ; then
70 smf_kill_contract
$2 KILL
1
75 echo "Usage: $0 { start | stop | refresh }"