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