xref: /titanic_51/usr/src/cmd/pools/svc-pools (revision 6927f468b0af7710df000f6b16f6ee413e1e3007)
126d8ba22Sgarypen#!/sbin/sh
226d8ba22Sgarypen#
326d8ba22Sgarypen# CDDL HEADER START
426d8ba22Sgarypen#
526d8ba22Sgarypen# The contents of this file are subject to the terms of the
626d8ba22Sgarypen# Common Development and Distribution License (the "License").
726d8ba22Sgarypen# You may not use this file except in compliance with the License.
826d8ba22Sgarypen#
926d8ba22Sgarypen# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1026d8ba22Sgarypen# or http://www.opensolaris.org/os/licensing.
1126d8ba22Sgarypen# See the License for the specific language governing permissions
1226d8ba22Sgarypen# and limitations under the License.
1326d8ba22Sgarypen#
1426d8ba22Sgarypen# When distributing Covered Code, include this CDDL HEADER in each
1526d8ba22Sgarypen# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1626d8ba22Sgarypen# If applicable, add the following below this CDDL HEADER, with the
1726d8ba22Sgarypen# fields enclosed by brackets "[]" replaced with your own identifying
1826d8ba22Sgarypen# information: Portions Copyright [yyyy] [name of copyright owner]
1926d8ba22Sgarypen#
2026d8ba22Sgarypen# CDDL HEADER END
2126d8ba22Sgarypen#
2226d8ba22Sgarypen#
23*6927f468Sdp# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
2426d8ba22Sgarypen# Use is subject to license terms.
2526d8ba22Sgarypen#
2626d8ba22Sgarypen# ident	"%Z%%M%	%I%	%E% SMI"
2726d8ba22Sgarypen#
2826d8ba22Sgarypen# Method script for the pools service.
2926d8ba22Sgarypen#
3026d8ba22Sgarypen
3126d8ba22Sgarypen. /lib/svc/share/smf_include.sh
3226d8ba22Sgarypen
33*6927f468Sdpif [ ! -x /usr/sbin/pooladm ]; then
34*6927f468Sdp	echo "/usr/sbin/pooladm not found or not executable"
3526d8ba22Sgarypen	exit $SMF_EXIT_ERR_FATAL
3626d8ba22Sgarypenfi
3726d8ba22Sgarypen
38*6927f468Sdpif smf_is_nonglobalzone; then
39*6927f468Sdp	echo "pools service is only available in the global zone"
40*6927f468Sdp	exit $SMF_EXIT_ERR_FATAL
41*6927f468Sdpfi
42*6927f468Sdp
4326d8ba22Sgarypencase "$1" in
4426d8ba22Sgarypen'start')
4526d8ba22Sgarypen	/usr/sbin/pooladm -e
4626d8ba22Sgarypen	if [ $? -ne 0 ]; then
4726d8ba22Sgarypen		exit $SMF_EXIT_ERR_FATAL
4826d8ba22Sgarypen	fi
4926d8ba22Sgarypen	if [ -f /etc/pooladm.conf ]; then
5026d8ba22Sgarypen		/usr/sbin/pooladm -c
5126d8ba22Sgarypen		if [ $? -ne 0 ]; then
5226d8ba22Sgarypen			/usr/sbin/pooladm -d
5326d8ba22Sgarypen			exit $SMF_EXIT_ERR_CONFIG
5426d8ba22Sgarypen		fi
5526d8ba22Sgarypen	fi
5626d8ba22Sgarypen	;;
5726d8ba22Sgarypen'stop')
5826d8ba22Sgarypen	/usr/sbin/pooladm -x
5926d8ba22Sgarypen	if [ $? -ne 0 ]; then
6026d8ba22Sgarypen		exit $SMF_EXIT_ERR_FATAL
6126d8ba22Sgarypen	fi
6226d8ba22Sgarypen	/usr/sbin/pooladm -d
6326d8ba22Sgarypen	if [ $? -ne 0 ]; then
6426d8ba22Sgarypen		exit $SMF_EXIT_ERR_FATAL
6526d8ba22Sgarypen	fi
6626d8ba22Sgarypen	;;
6726d8ba22Sgarypen'refresh')
6826d8ba22Sgarypen	if [ -f /etc/pooladm.conf ]; then
6926d8ba22Sgarypen		/usr/sbin/pooladm -c
7026d8ba22Sgarypen		if [ $? -ne 0 ]; then
7126d8ba22Sgarypen			exit $SMF_EXIT_ERR_CONFIG
7226d8ba22Sgarypen		fi
7326d8ba22Sgarypen	fi
7426d8ba22Sgarypen	;;
7526d8ba22Sgarypen*)
7626d8ba22Sgarypen	echo "Usage: $0 { start | stop | refresh}"
7726d8ba22Sgarypen	exit $SMF_EXIT_ERR_FATAL
7826d8ba22Sgarypen	;;
7926d8ba22Sgarypenesac
8026d8ba22Sgarypen
8126d8ba22Sgarypenexit $SMF_EXIT_OK
82