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