Print this page
XXX Remove nawk(1)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/sendmail/lib/smtp-sendmail
+++ new/usr/src/cmd/sendmail/lib/smtp-sendmail
1 1 #!/sbin/sh
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 23 # Use is subject to license terms.
24 24
25 25 . /lib/svc/share/smf_include.sh
26 26 . /lib/svc/share/sendmail_include.sh
27 27
28 28 ERRMSG1='WARNING: /var/mail is NFS-mounted without setting actimeo=0,'
29 29 ERRMSG2='this can cause mailbox locking and access problems.'
30 30 SERVER_PID_FILE="/var/run/sendmail.pid"
31 31 ALIASES_FILE="/etc/mail/aliases"
32 32 SENDMAIL_CF="/etc/mail/sendmail.cf"
33 33
34 34 case "$1" in
35 35 'refresh')
36 36 [ -f $SERVER_PID_FILE ] && kill -1 `head -1 $SERVER_PID_FILE`
37 37 ;;
38 38
39 39 'start')
40 40 exist_or_exit $SENDMAIL
41 41 if [ ! -d /var/spool/mqueue ]; then
42 42 /usr/bin/mkdir -m 0750 /var/spool/mqueue
43 43 /usr/bin/chown root:bin /var/spool/mqueue
44 44 fi
45 45 if [ ! -f $ALIASES_FILE.db ] && [ ! -f $ALIASES_FILE.dir ] \
46 46 && [ ! -f $ALIASES_FILE.pag ]; then
47 47 /usr/sbin/newaliases
48 48 fi
49 49 MODE="-bd"
50 50 [ -f $DEFAULT_FILE ] && . $DEFAULT_FILE
51 51 #
52 52 # * MODE should be "-bd" or null (MODE= or MODE="") or
53 53 # left alone. Anything else and you're on your own.
54 54 # * QUEUEOPTION should be "p" or null (as above).
55 55 # * QUEUEINTERVAL should be set to some legal value;
56 56 # sanity checks are done below.
57 57 # * OPTIONS are catch-alls; set with care.
58 58 #
59 59 if [ -n "$QUEUEOPTION" -a "$QUEUEOPTION" != "p" ]; then
60 60 QUEUEOPTION=""
61 61 fi
62 62 if [ -z "$QUEUEOPTION" -o -n "$QUEUEINTERVAL" ]; then
63 63 check_queue_interval_syntax $QUEUEINTERVAL
64 64 QUEUEINTERVAL=$answer
65 65 fi
66 66
67 67 local=`/usr/bin/svcprop -p config/local_only $SMF_FMRI 2>/dev/null`
68 68 if [ $? -eq 0 -a "$local" = "true" ]; then
69 69 MODE="-bl"
70 70 fi
71 71 sendmail_path=`svcprop -p config/path_to_sendmail_mc $SMF_FMRI \
72 72 2>/dev/null`
73 73 if [ $? -eq 0 -a -n "$sendmail_path" ]; then
74 74 turn_m4_crank "$SENDMAIL_CF" "$sendmail_path"
75 75 fi
76 76 exist_or_exit "$SENDMAIL_CF"
77 77
78 78 $SENDMAIL $MODE -q$QUEUEOPTION$QUEUEINTERVAL $OPTIONS &
79 79
80 80 #
81 81 # ETRN_HOSTS should be of the form
82 82 # "s1:c1.1,c1.2 s2:c2.1 s3:c3.1,c3.2,c3.3"
83 83 # i.e., white-space separated groups of server:client where
84 84 # client can be one or more comma-separated names; N.B. that
85 85 # the :client part is optional; see etrn(1M) for details.
86 86 # server is the name of the server to prod; a mail queue run
87 87 # is requested for each client name. This is comparable to
88 88 # running "/usr/lib/sendmail -qRclient" on the host server.
↓ open down ↓ |
88 lines elided |
↑ open up ↑ |
89 89 #
90 90 # See RFC 1985 for more information.
91 91 #
92 92 for i in $ETRN_HOSTS; do
93 93 SERVER=`echo $i | /usr/bin/sed -e 's/:.*$//'`
94 94 CLIENTS=`echo $i | /usr/bin/sed -n -e 's/,/ /g' \
95 95 -e '/:/s/^.*://p'`
96 96 /usr/sbin/etrn -b $SERVER $CLIENTS >/dev/null 2>&1 &
97 97 done
98 98
99 - if /usr/bin/nawk 'BEGIN{s = 1}
99 + if /usr/xpg4/bin/awk 'BEGIN{s = 1}
100 100 $2 == "/var/mail" && $3 == "nfs" && $4 !~ /actimeo=0/ &&
101 101 $4 !~ /noac/{s = 0} END{exit s}' /etc/mnttab; then
102 102
103 103 /usr/bin/logger -p mail.crit "$ERRMSG1"
104 104 /usr/bin/logger -p mail.crit "$ERRMSG2"
105 105 fi
106 106 ;;
107 107
108 108 'stop')
109 109 [ -f $SERVER_PID_FILE ] && check_and_kill $SERVER_PID_FILE
110 110 # Need to kill the entire service contract to kill all sendmail related
111 111 # processes
112 112 smf_kill_contract $2 TERM 1 30
113 113 ret=$?
114 114 [ $ret -eq 1 ] && exit 1
115 115
116 116 # Since sendmail spawns user processes out of .forward files, it is
117 117 # possible that some of these are not responding to TERM. If the
118 118 # contract did not empty after TERM, move on to KILL.
119 119 if [ $ret -eq 2 ] ; then
120 120 smf_kill_contract $2 KILL 1
121 121 fi
122 122 ;;
123 123
124 124 *)
125 125 echo "Usage: $0 { start | stop | refresh }"
126 126 exit 1
127 127 ;;
128 128 esac
129 129 exit 0
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX