svc-zones revision 9e7542f43664efd48128a1fadc2ac760103bdad6
2N/A# The contents of this file are subject to the terms of the 2N/A# Common Development and Distribution License (the "License"). 2N/A# You may not use this file except in compliance with the License. 2N/A# See the License for the specific language governing permissions 2N/A# and limitations under the License. 2N/A# When distributing Covered Code, include this CDDL HEADER in each 2N/A# If applicable, add the following below this CDDL HEADER, with the 2N/A# fields enclosed by brackets "[]" replaced with your own identifying 2N/A# information: Portions Copyright [yyyy] [name of copyright owner] 2N/A# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 2N/A# Use is subject to license terms. 2N/A# ident "%Z%%M% %I% %E% SMI" 2N/A# Make sure working directory is / to prevent unmounting problems. 2N/A if ($3 == "installed") { 2N/A # zoneadmd puts itself into its own contract so 2N/A # this service will lose sight of it. We don't 2N/A # support restart so it is OK for zoneadmd to 2N/A # to be in an orphaned contract. 2N/A # Wait for all zoneadm processes to finish before allowing the 2N/A # start method to exit. 2N/A echo "Shutting down running zones (for up to $MAXSHUT seconds):\c" 2N/A # First, try letting them run their shutdown scripts. 2N/A # Allow time for zones to shutdown cleanly 2N/A # Second, try halting them. if [
"$zone" !=
"global" ];
then echo "Zones failed to shutdown; trying to halt " \
# Wait for the 'zoneadm halt' commands to complete. We will let this # run forever, since the restart daemon will eventually kill us off # anyway if the halts do not complete after a certain period of time. # If the halts complete but a zone is still not shutdown, it might # be in a state like 'shutting_down' or 'down'. So we give it some # time to come all the way down. sleep 1 # wait a bit longer # Report on zones which failed to shutdown. if [
"$zone" !=
"global" ];
then echo "Zone '$zone' failed to halt." [
"`zoneadm list`" !=
"global" ] &&
exit 1 # zones still running echo "Usage: $0 { start | stop }"