svc-pools revision 6927f468b0af7710df000f6b16f6ee413e1e3007
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync#!/sbin/sh
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync#
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# CDDL HEADER START
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync#
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# The contents of this file are subject to the terms of the
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# Common Development and Distribution License (the "License").
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync# You may not use this file except in compliance with the License.
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync#
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# or http://www.opensolaris.org/os/licensing.
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# See the License for the specific language governing permissions
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# and limitations under the License.
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync#
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# When distributing Covered Code, include this CDDL HEADER in each
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# If applicable, add the following below this CDDL HEADER, with the
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# fields enclosed by brackets "[]" replaced with your own identifying
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# information: Portions Copyright [yyyy] [name of copyright owner]
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync#
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# CDDL HEADER END
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync#
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync#
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# Use is subject to license terms.
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync#
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# ident "%Z%%M% %I% %E% SMI"
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync#
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync# Method script for the pools service.
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync#
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync. /lib/svc/share/smf_include.sh
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsyncif [ ! -x /usr/sbin/pooladm ]; then
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync echo "/usr/sbin/pooladm not found or not executable"
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync exit $SMF_EXIT_ERR_FATAL
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsyncfi
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsyncif smf_is_nonglobalzone; then
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync echo "pools service is only available in the global zone"
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync exit $SMF_EXIT_ERR_FATAL
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsyncfi
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync
258d89b5c228e2b8c4d621991979c9df5783012fvboxsynccase "$1" in
71955773a7f477f9a159a491f765ba97e1f00e1avboxsync'start')
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync /usr/sbin/pooladm -e
c9579522f347fc3fda6b3f4add0b355981cd7758vboxsync if [ $? -ne 0 ]; then
b06e6c768b741a16534846e399da98ffc59693dbvboxsync exit $SMF_EXIT_ERR_FATAL
b06e6c768b741a16534846e399da98ffc59693dbvboxsync fi
b06e6c768b741a16534846e399da98ffc59693dbvboxsync if [ -f /etc/pooladm.conf ]; then
b06e6c768b741a16534846e399da98ffc59693dbvboxsync /usr/sbin/pooladm -c
b06e6c768b741a16534846e399da98ffc59693dbvboxsync if [ $? -ne 0 ]; then
b06e6c768b741a16534846e399da98ffc59693dbvboxsync /usr/sbin/pooladm -d
b06e6c768b741a16534846e399da98ffc59693dbvboxsync exit $SMF_EXIT_ERR_CONFIG
b06e6c768b741a16534846e399da98ffc59693dbvboxsync fi
b06e6c768b741a16534846e399da98ffc59693dbvboxsync fi
b06e6c768b741a16534846e399da98ffc59693dbvboxsync ;;
b06e6c768b741a16534846e399da98ffc59693dbvboxsync'stop')
b06e6c768b741a16534846e399da98ffc59693dbvboxsync /usr/sbin/pooladm -x
b06e6c768b741a16534846e399da98ffc59693dbvboxsync if [ $? -ne 0 ]; then
b06e6c768b741a16534846e399da98ffc59693dbvboxsync exit $SMF_EXIT_ERR_FATAL
b06e6c768b741a16534846e399da98ffc59693dbvboxsync fi
b06e6c768b741a16534846e399da98ffc59693dbvboxsync /usr/sbin/pooladm -d
b06e6c768b741a16534846e399da98ffc59693dbvboxsync if [ $? -ne 0 ]; then
b06e6c768b741a16534846e399da98ffc59693dbvboxsync exit $SMF_EXIT_ERR_FATAL
b06e6c768b741a16534846e399da98ffc59693dbvboxsync fi
b06e6c768b741a16534846e399da98ffc59693dbvboxsync ;;
b06e6c768b741a16534846e399da98ffc59693dbvboxsync'refresh')
b06e6c768b741a16534846e399da98ffc59693dbvboxsync if [ -f /etc/pooladm.conf ]; then
b06e6c768b741a16534846e399da98ffc59693dbvboxsync /usr/sbin/pooladm -c
b06e6c768b741a16534846e399da98ffc59693dbvboxsync if [ $? -ne 0 ]; then
b06e6c768b741a16534846e399da98ffc59693dbvboxsync exit $SMF_EXIT_ERR_CONFIG
b06e6c768b741a16534846e399da98ffc59693dbvboxsync fi
b06e6c768b741a16534846e399da98ffc59693dbvboxsync fi
b06e6c768b741a16534846e399da98ffc59693dbvboxsync ;;
b06e6c768b741a16534846e399da98ffc59693dbvboxsync*)
b06e6c768b741a16534846e399da98ffc59693dbvboxsync echo "Usage: $0 { start | stop | refresh}"
b06e6c768b741a16534846e399da98ffc59693dbvboxsync exit $SMF_EXIT_ERR_FATAL
b06e6c768b741a16534846e399da98ffc59693dbvboxsync ;;
b06e6c768b741a16534846e399da98ffc59693dbvboxsyncesac
b06e6c768b741a16534846e399da98ffc59693dbvboxsync
b06e6c768b741a16534846e399da98ffc59693dbvboxsyncexit $SMF_EXIT_OK
b06e6c768b741a16534846e399da98ffc59693dbvboxsync