svc-pkg-depot revision 1976
# The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # See the License for the specific language governing permissions # and limitations under the License. # When distributing Covered Code, include this CDDL HEADER in each # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # Copyright (c) 2009, 2010 Oracle and/or its affiliates. All rights reserved. # Load SMF constants and functions echo "this script can only be invoked by smf(5)" # retrieve the pkg_root property. If the variable is left empty # make sure pkg_root ends with a / # adjust the PYTHONPATH to point to the current environment # we need to make sure to adjust the PYTHONPATH accordingly # to a Python 2.4 or 2.6 environment # If this process has net_privaddr, then we pass it along. # If not, we ensure that we don't specify it, since that will # cause ppriv to throw an error. echo "Dropping net_privaddr privilege." # Build up the privileges available starting with "basic". This # provides some protection even when the depot runs as root. A=basic,-file_link_any,-proc_info,-proc_session$privaddr -e" # Echo the command so that the log contains the command used to start # Strategy: First, try shutting down depot using polite kill. Use up # as much as possible of the allotted timeout period waiting for polite # kill to take effect. As time runs out, try a more aggressive kill. # Note that we're working around an oddity in smf_kill_contract: it # waits in 5 second chunks and can overshoot the specified timeout # by as many as 4 seconds. Example: a specified wait of 6 will result # in a wait of 10 seconds in reality. Since we may potentially do a # first kill and then a second, we must ensure that at least 8 seconds # of slop is left in reserve. To be paranoid, we go for 10. # '2' indicates timeout with non-empty contract. echo "Gentle contract kill timed out after" \
"$POLITE seconds, trying SIGKILL." >&
2 # Again, despite the specified timeout, this will # take a minimum of 5 seconds to complete. # If the timeout is too short, we just try once, politely. echo "Usage: $0 { start | stop }"