1*4746Srica#!/bin/sh 2*4746Srica# 3*4746Srica# CDDL HEADER START 4*4746Srica# 5*4746Srica# The contents of this file are subject to the terms of the 6*4746Srica# Common Development and Distribution License (the "License"). 7*4746Srica# You may not use this file except in compliance with the License. 8*4746Srica# 9*4746Srica# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*4746Srica# or http://www.opensolaris.org/os/licensing. 11*4746Srica# See the License for the specific language governing permissions 12*4746Srica# and limitations under the License. 13*4746Srica# 14*4746Srica# When distributing Covered Code, include this CDDL HEADER in each 15*4746Srica# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*4746Srica# If applicable, add the following below this CDDL HEADER, with the 17*4746Srica# fields enclosed by brackets "[]" replaced with your own identifying 18*4746Srica# information: Portions Copyright [yyyy] [name of copyright owner] 19*4746Srica# 20*4746Srica# CDDL HEADER END 21*4746Srica# 22*4746Srica# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23*4746Srica# Use is subject to license terms. 24*4746Srica# 25*4746Srica#ident "%Z%%M% %I% %E% SMI" 26*4746Srica# 27*4746Srica# 28*4746Srica# Usage: 29*4746Srica# runwlabel "my-label" my-program 30*4746Srica# 31*4746Srica 32*4746Srica[ ! -x /usr/sbin/zoneadm ] && exit 0 # SUNWzoneu not installed 33*4746Srica 34*4746SricaPATH=/usr/sbin:/usr/bin; export PATH 35*4746Srica 36*4746Srica# Get the zone path associated with the "my-label" zone 37*4746Srica# Remove the trailing "/root" 38*4746Sricazonepath=`getzonepath "$1" | sed -e 's/\/root$//'` 39*4746Sricaprogname="$2" 40*4746Srica 41*4746Srica# Find the zone name that is associated with this zone path 42*4746Sricafor zone in `zoneadm list -pi | nawk -F: -v zonepath=${zonepath} '{ 43*4746Srica if ("$4" == "${zonepath}") { 44*4746Srica print $2 45*4746Srica } 46*4746Srica}'`; do 47*4746Srica # Run the specified command in the matching zone 48*4746Srica zlogin ${zone} ${progname} 49*4746Srica done 50*4746Sricaexit 51