xref: /titanic_51/usr/src/cmd/pools/svc-pools (revision 26d8ba2242584067b65160d24193c37cdc83cd55)
1*26d8ba22Sgarypen#!/sbin/sh
2*26d8ba22Sgarypen#
3*26d8ba22Sgarypen# CDDL HEADER START
4*26d8ba22Sgarypen#
5*26d8ba22Sgarypen# The contents of this file are subject to the terms of the
6*26d8ba22Sgarypen# Common Development and Distribution License (the "License").
7*26d8ba22Sgarypen# You may not use this file except in compliance with the License.
8*26d8ba22Sgarypen#
9*26d8ba22Sgarypen# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*26d8ba22Sgarypen# or http://www.opensolaris.org/os/licensing.
11*26d8ba22Sgarypen# See the License for the specific language governing permissions
12*26d8ba22Sgarypen# and limitations under the License.
13*26d8ba22Sgarypen#
14*26d8ba22Sgarypen# When distributing Covered Code, include this CDDL HEADER in each
15*26d8ba22Sgarypen# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*26d8ba22Sgarypen# If applicable, add the following below this CDDL HEADER, with the
17*26d8ba22Sgarypen# fields enclosed by brackets "[]" replaced with your own identifying
18*26d8ba22Sgarypen# information: Portions Copyright [yyyy] [name of copyright owner]
19*26d8ba22Sgarypen#
20*26d8ba22Sgarypen# CDDL HEADER END
21*26d8ba22Sgarypen#
22*26d8ba22Sgarypen#
23*26d8ba22Sgarypen# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*26d8ba22Sgarypen# Use is subject to license terms.
25*26d8ba22Sgarypen#
26*26d8ba22Sgarypen# ident	"%Z%%M%	%I%	%E% SMI"
27*26d8ba22Sgarypen#
28*26d8ba22Sgarypen# Method script for the pools service.
29*26d8ba22Sgarypen#
30*26d8ba22Sgarypen
31*26d8ba22Sgarypen. /lib/svc/share/smf_include.sh
32*26d8ba22Sgarypen
33*26d8ba22Sgarypencheck_requirements () {
34*26d8ba22Sgarypen	if [ ! -x /sbin/zonename ] || [ ! -x /usr/sbin/pooladm ] ||
35*26d8ba22Sgarypen	    [ "${_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then
36*26d8ba22Sgarypen		exit $SMF_EXIT_ERR_FATAL
37*26d8ba22Sgarypen	fi
38*26d8ba22Sgarypen}
39*26d8ba22Sgarypen
40*26d8ba22Sgarypencheck_requirements
41*26d8ba22Sgarypencase "$1" in
42*26d8ba22Sgarypen'start')
43*26d8ba22Sgarypen	/usr/sbin/pooladm -e
44*26d8ba22Sgarypen	if [ $? -ne 0 ]; then
45*26d8ba22Sgarypen		exit $SMF_EXIT_ERR_FATAL
46*26d8ba22Sgarypen	fi
47*26d8ba22Sgarypen	if [ -f /etc/pooladm.conf ]; then
48*26d8ba22Sgarypen		/usr/sbin/pooladm -c
49*26d8ba22Sgarypen		if [ $? -ne 0 ]; then
50*26d8ba22Sgarypen			/usr/sbin/pooladm -d
51*26d8ba22Sgarypen			exit $SMF_EXIT_ERR_CONFIG
52*26d8ba22Sgarypen		fi
53*26d8ba22Sgarypen	fi
54*26d8ba22Sgarypen	;;
55*26d8ba22Sgarypen'stop')
56*26d8ba22Sgarypen	/usr/sbin/pooladm -x
57*26d8ba22Sgarypen	if [ $? -ne 0 ]; then
58*26d8ba22Sgarypen		exit $SMF_EXIT_ERR_FATAL
59*26d8ba22Sgarypen	fi
60*26d8ba22Sgarypen	/usr/sbin/pooladm -d
61*26d8ba22Sgarypen	if [ $? -ne 0 ]; then
62*26d8ba22Sgarypen		exit $SMF_EXIT_ERR_FATAL
63*26d8ba22Sgarypen	fi
64*26d8ba22Sgarypen	;;
65*26d8ba22Sgarypen'refresh')
66*26d8ba22Sgarypen	if [ -f /etc/pooladm.conf ]; then
67*26d8ba22Sgarypen		/usr/sbin/pooladm -c
68*26d8ba22Sgarypen		if [ $? -ne 0 ]; then
69*26d8ba22Sgarypen			exit $SMF_EXIT_ERR_CONFIG
70*26d8ba22Sgarypen		fi
71*26d8ba22Sgarypen	fi
72*26d8ba22Sgarypen	;;
73*26d8ba22Sgarypen*)
74*26d8ba22Sgarypen	echo "Usage: $0 { start | stop | refresh}"
75*26d8ba22Sgarypen	exit $SMF_EXIT_ERR_FATAL
76*26d8ba22Sgarypen	;;
77*26d8ba22Sgarypenesac
78*26d8ba22Sgarypen
79*26d8ba22Sgarypenexit $SMF_EXIT_OK
80