svc-iscsitgt revision f3861e1a2ceec23a5b699c24d814b7775a9e0b52
60405de4d8688d96dd05157c28db3ade5c9bc234kz#!/sbin/sh
60405de4d8688d96dd05157c28db3ade5c9bc234kz#
60405de4d8688d96dd05157c28db3ade5c9bc234kz# CDDL HEADER START
60405de4d8688d96dd05157c28db3ade5c9bc234kz#
60405de4d8688d96dd05157c28db3ade5c9bc234kz# The contents of this file are subject to the terms of the
60405de4d8688d96dd05157c28db3ade5c9bc234kz# Common Development and Distribution License (the "License").
60405de4d8688d96dd05157c28db3ade5c9bc234kz# You may not use this file except in compliance with the License.
60405de4d8688d96dd05157c28db3ade5c9bc234kz#
60405de4d8688d96dd05157c28db3ade5c9bc234kz# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
60405de4d8688d96dd05157c28db3ade5c9bc234kz# or http://www.opensolaris.org/os/licensing.
60405de4d8688d96dd05157c28db3ade5c9bc234kz# See the License for the specific language governing permissions
60405de4d8688d96dd05157c28db3ade5c9bc234kz# and limitations under the License.
60405de4d8688d96dd05157c28db3ade5c9bc234kz#
60405de4d8688d96dd05157c28db3ade5c9bc234kz# When distributing Covered Code, include this CDDL HEADER in each
60405de4d8688d96dd05157c28db3ade5c9bc234kz# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
60405de4d8688d96dd05157c28db3ade5c9bc234kz# If applicable, add the following below this CDDL HEADER, with the
60405de4d8688d96dd05157c28db3ade5c9bc234kz# fields enclosed by brackets "[]" replaced with your own identifying
60405de4d8688d96dd05157c28db3ade5c9bc234kz# information: Portions Copyright [yyyy] [name of copyright owner]
60405de4d8688d96dd05157c28db3ade5c9bc234kz#
60405de4d8688d96dd05157c28db3ade5c9bc234kz# CDDL HEADER END
60405de4d8688d96dd05157c28db3ade5c9bc234kz#
60405de4d8688d96dd05157c28db3ade5c9bc234kz
60405de4d8688d96dd05157c28db3ade5c9bc234kz#
60405de4d8688d96dd05157c28db3ade5c9bc234kz# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
60405de4d8688d96dd05157c28db3ade5c9bc234kz# Use is subject to license terms.
60405de4d8688d96dd05157c28db3ade5c9bc234kz#
60405de4d8688d96dd05157c28db3ade5c9bc234kz# ident "%Z%%M% %I% %E% SMI"
60405de4d8688d96dd05157c28db3ade5c9bc234kz#
60405de4d8688d96dd05157c28db3ade5c9bc234kz
60405de4d8688d96dd05157c28db3ade5c9bc234kz. /lib/svc/share/smf_include.sh
60405de4d8688d96dd05157c28db3ade5c9bc234kzzone=`smf_zonename`
60405de4d8688d96dd05157c28db3ade5c9bc234kz
60405de4d8688d96dd05157c28db3ade5c9bc234kzcase "$1" in
d0538f66491267879b7418b21ad78e3dcc2dcc83cg'start')
d02310705313ee2fcefee164a4b26d1fa85e9d22miao chen - Sun Microsystems - Beijing China if smf_is_nonglobalzone; then
d0538f66491267879b7418b21ad78e3dcc2dcc83cg /usr/sbin/svcadm disable -t svc:/system/iscsitgt
d0538f66491267879b7418b21ad78e3dcc2dcc83cg echo "The iSCSI target is not supported in a local zone"
60405de4d8688d96dd05157c28db3ade5c9bc234kz sleep 5 &
60405de4d8688d96dd05157c28db3ade5c9bc234kz exit $SMF_EXIT_OK
60405de4d8688d96dd05157c28db3ade5c9bc234kz fi
60405de4d8688d96dd05157c28db3ade5c9bc234kz
60405de4d8688d96dd05157c28db3ade5c9bc234kz /usr/sbin/iscsitgtd
60405de4d8688d96dd05157c28db3ade5c9bc234kz
60405de4d8688d96dd05157c28db3ade5c9bc234kz if [ $? -ne 0 ]; then
60405de4d8688d96dd05157c28db3ade5c9bc234kz echo "Failed to start iSCSI daemon"
60405de4d8688d96dd05157c28db3ade5c9bc234kz exit 1
60405de4d8688d96dd05157c28db3ade5c9bc234kz fi
e92e3a8694f157faf8a9e44096a70ada86c556bfzw
60405de4d8688d96dd05157c28db3ade5c9bc234kz if [ -x /usr/sbin/zfs ]; then
d0538f66491267879b7418b21ad78e3dcc2dcc83cg /usr/sbin/zfs share -a iscsi
60405de4d8688d96dd05157c28db3ade5c9bc234kz fi
60405de4d8688d96dd05157c28db3ade5c9bc234kz
60405de4d8688d96dd05157c28db3ade5c9bc234kz ;;
60405de4d8688d96dd05157c28db3ade5c9bc234kz
60405de4d8688d96dd05157c28db3ade5c9bc234kz'stop')
60405de4d8688d96dd05157c28db3ade5c9bc234kz # Kill any processes in the service contract
60405de4d8688d96dd05157c28db3ade5c9bc234kz smf_kill_contract $2 TERM 1
60405de4d8688d96dd05157c28db3ade5c9bc234kz [ $? -ne 0 ] && exit 1
e92e3a8694f157faf8a9e44096a70ada86c556bfzw ;;
e92e3a8694f157faf8a9e44096a70ada86c556bfzw
e92e3a8694f157faf8a9e44096a70ada86c556bfzw*)
e92e3a8694f157faf8a9e44096a70ada86c556bfzw echo "Usage: $0 { start | stop }"
e92e3a8694f157faf8a9e44096a70ada86c556bfzw exit 1
e92e3a8694f157faf8a9e44096a70ada86c556bfzw ;;
e92e3a8694f157faf8a9e44096a70ada86c556bfzwesac
60405de4d8688d96dd05157c28db3ade5c9bc234kz
d02310705313ee2fcefee164a4b26d1fa85e9d22miao chen - Sun Microsystems - Beijing Chinaexit $SMF_EXIT_OK
d02310705313ee2fcefee164a4b26d1fa85e9d22miao chen - Sun Microsystems - Beijing China