3380N/A#!/usr/sbin/sh
3380N/A#
3380N/A# CDDL HEADER START
3380N/A#
3380N/A# The contents of this file are subject to the terms of the
3380N/A# Common Development and Distribution License (the "License").
3380N/A# You may not use this file except in compliance with the License.
3380N/A#
3380N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
3380N/A# or http://www.opensolaris.org/os/licensing.
3380N/A# See the License for the specific language governing permissions
3380N/A# and limitations under the License.
3380N/A#
3380N/A# When distributing Covered Code, include this CDDL HEADER in each
3380N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
3380N/A# If applicable, add the following below this CDDL HEADER, with the
3380N/A# fields enclosed by brackets "[]" replaced with your own identifying
3380N/A# information: Portions Copyright [yyyy] [name of copyright owner]
3380N/A#
3380N/A# CDDL HEADER END
3380N/A#
3380N/A# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
3380N/A
3380N/A. /lib/svc/share/smf_include.sh
3380N/A. /lib/svc/share/sendmail_include.sh
3380N/A
3380N/ACLIENT_PID_FILE="/var/spool/clientmqueue/sm-client.pid"
3380N/ASUBMIT_CF="/etc/mail/submit.cf"
3380N/A
3380N/Acase "$1" in
3380N/A'refresh')
3380N/A [ -f $CLIENT_PID_FILE ] && kill -1 `head -1 $CLIENT_PID_FILE`
3380N/A ;;
3380N/A
3380N/A'start')
3380N/A exist_or_exit $SENDMAIL
3380N/A [ -f $DEFAULT_FILE ] && . $DEFAULT_FILE
3380N/A #
3380N/A # * CLIENTQUEUEINTERVAL should be set to some legal value;
3380N/A # sanity checks are done below.
3380N/A # * CLIENTOPTIONS are catch-alls; set with care.
#
check_queue_interval_syntax $CLIENTQUEUEINTERVAL
CLIENTQUEUEINTERVAL=$answer
submit_path=`svcprop -p config/path_to_submit_mc $SMF_FMRI 2>/dev/null`
if [ $? -eq 0 -a -n "$submit_path" ]; then
turn_m4_crank "$SUBMIT_CF" "$submit_path"
fi
exist_or_exit "$SUBMIT_CF"
$SENDMAIL -Ac -q$CLIENTQUEUEINTERVAL $CLIENTOPTIONS &
;;
'stop')
if [ -f $CLIENT_PID_FILE ]; then
check_and_kill $CLIENT_PID_FILE
rm -f $CLIENT_PID_FILE
fi
# Need to kill the entire service contract to kill all sendmail related
# processes
smf_kill_contract $2 TERM 1 30
ret=$?
[ $ret -eq 1 ] && exit 1
# Sendmail can take its time responding to SIGTERM, as it waits for
# things like child processes and SMTP connections to clean up. If
# the contract did not empty after TERM, move on to KILL.
if [ $ret -eq 2 ] ; then
smf_kill_contract $2 KILL 1
fi
;;
*)
echo "Usage: $0 { start | stop | refresh }"
exit 1
;;
esac
exit 0