18838SJohn.Beck@Sun.COM#!/sbin/sh 28838SJohn.Beck@Sun.COM# 38838SJohn.Beck@Sun.COM# CDDL HEADER START 48838SJohn.Beck@Sun.COM# 58838SJohn.Beck@Sun.COM# The contents of this file are subject to the terms of the 68838SJohn.Beck@Sun.COM# Common Development and Distribution License (the "License"). 78838SJohn.Beck@Sun.COM# You may not use this file except in compliance with the License. 88838SJohn.Beck@Sun.COM# 98838SJohn.Beck@Sun.COM# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 108838SJohn.Beck@Sun.COM# or http://www.opensolaris.org/os/licensing. 118838SJohn.Beck@Sun.COM# See the License for the specific language governing permissions 128838SJohn.Beck@Sun.COM# and limitations under the License. 138838SJohn.Beck@Sun.COM# 148838SJohn.Beck@Sun.COM# When distributing Covered Code, include this CDDL HEADER in each 158838SJohn.Beck@Sun.COM# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 168838SJohn.Beck@Sun.COM# If applicable, add the following below this CDDL HEADER, with the 178838SJohn.Beck@Sun.COM# fields enclosed by brackets "[]" replaced with your own identifying 188838SJohn.Beck@Sun.COM# information: Portions Copyright [yyyy] [name of copyright owner] 198838SJohn.Beck@Sun.COM# 208838SJohn.Beck@Sun.COM# CDDL HEADER END 218838SJohn.Beck@Sun.COM# 228838SJohn.Beck@Sun.COM# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 238838SJohn.Beck@Sun.COM# Use is subject to license terms. 248838SJohn.Beck@Sun.COM 258838SJohn.Beck@Sun.COM. /lib/svc/share/smf_include.sh 268838SJohn.Beck@Sun.COM. /lib/svc/share/sendmail_include.sh 278838SJohn.Beck@Sun.COM 288838SJohn.Beck@Sun.COMCLIENT_PID_FILE="/var/spool/clientmqueue/sm-client.pid" 298838SJohn.Beck@Sun.COMSUBMIT_CF="/etc/mail/submit.cf" 308838SJohn.Beck@Sun.COM 318838SJohn.Beck@Sun.COMcase "$1" in 328838SJohn.Beck@Sun.COM'refresh') 338838SJohn.Beck@Sun.COM [ -f $CLIENT_PID_FILE ] && kill -1 `head -1 $CLIENT_PID_FILE` 348838SJohn.Beck@Sun.COM ;; 358838SJohn.Beck@Sun.COM 368838SJohn.Beck@Sun.COM'start') 378838SJohn.Beck@Sun.COM exist_or_exit $SENDMAIL 388838SJohn.Beck@Sun.COM [ -f $DEFAULT_FILE ] && . $DEFAULT_FILE 398838SJohn.Beck@Sun.COM # 408838SJohn.Beck@Sun.COM # * CLIENTQUEUEINTERVAL should be set to some legal value; 418838SJohn.Beck@Sun.COM # sanity checks are done below. 428838SJohn.Beck@Sun.COM # * CLIENTOPTIONS are catch-alls; set with care. 438838SJohn.Beck@Sun.COM # 448838SJohn.Beck@Sun.COM check_queue_interval_syntax $CLIENTQUEUEINTERVAL 458838SJohn.Beck@Sun.COM CLIENTQUEUEINTERVAL=$answer 468838SJohn.Beck@Sun.COM 478838SJohn.Beck@Sun.COM submit_path=`svcprop -p config/path_to_submit_mc $SMF_FMRI 2>/dev/null` 488838SJohn.Beck@Sun.COM if [ $? -eq 0 -a -n "$submit_path" ]; then 49*9856SJohn.Beck@Sun.COM turn_m4_crank "$SUBMIT_CF" "$submit_path" 508838SJohn.Beck@Sun.COM fi 51*9856SJohn.Beck@Sun.COM exist_or_exit "$SUBMIT_CF" 528838SJohn.Beck@Sun.COM 538838SJohn.Beck@Sun.COM $SENDMAIL -Ac -q$CLIENTQUEUEINTERVAL $CLIENTOPTIONS & 548838SJohn.Beck@Sun.COM ;; 558838SJohn.Beck@Sun.COM 568838SJohn.Beck@Sun.COM'stop') 578838SJohn.Beck@Sun.COM if [ -f $CLIENT_PID_FILE ]; then 588838SJohn.Beck@Sun.COM check_and_kill $CLIENT_PID_FILE 598838SJohn.Beck@Sun.COM rm -f $CLIENT_PID_FILE 608838SJohn.Beck@Sun.COM fi 618838SJohn.Beck@Sun.COM # Need to kill the entire service contract to kill all sendmail related 628838SJohn.Beck@Sun.COM # processes 638838SJohn.Beck@Sun.COM smf_kill_contract $2 TERM 1 30 648838SJohn.Beck@Sun.COM ret=$? 658838SJohn.Beck@Sun.COM [ $ret -eq 1 ] && exit 1 668838SJohn.Beck@Sun.COM 678838SJohn.Beck@Sun.COM # Sendmail can take its time responding to SIGTERM, as it waits for 688838SJohn.Beck@Sun.COM # things like child processes and SMTP connections to clean up. If 698838SJohn.Beck@Sun.COM # the contract did not empty after TERM, move on to KILL. 708838SJohn.Beck@Sun.COM if [ $ret -eq 2 ] ; then 718838SJohn.Beck@Sun.COM smf_kill_contract $2 KILL 1 728838SJohn.Beck@Sun.COM fi 738838SJohn.Beck@Sun.COM ;; 748838SJohn.Beck@Sun.COM 758838SJohn.Beck@Sun.COM*) 768838SJohn.Beck@Sun.COM echo "Usage: $0 { start | stop | refresh }" 778838SJohn.Beck@Sun.COM exit 1 788838SJohn.Beck@Sun.COM ;; 798838SJohn.Beck@Sun.COMesac 808838SJohn.Beck@Sun.COMexit 0 81