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