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