svc-pkg-mdns revision 1902
229N/A# The contents of this file are subject to the terms of the 229N/A# Common Development and Distribution License (the "License"). 229N/A# You may not use this file except in compliance with the License. 229N/A# See the License for the specific language governing permissions 229N/A# and limitations under the License. 229N/A# When distributing Covered Code, include this CDDL HEADER in each 229N/A# If applicable, add the following below this CDDL HEADER, with the 229N/A# fields enclosed by brackets "[]" replaced with your own identifying 229N/A# information: Portions Copyright [yyyy] [name of copyright owner] 229N/A# Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. 1244N/A# Load SMF constants and functions 229N/A echo "this script can only be invoked by smf(5)" 229N/A # Handles mDNS depot startup 229N/A # short_option_props are properties which are communicated to the depot 229N/A # via a single character flag which takes an argument. 1938N/A # retrieve the pkg_root property. If the variable is left empty 229N/A # make sure pkg_root ends with a / 229N/A # adjust the PYTHONPATH to point to the current environment 229N/A # we need to make sure to adjust the PYTHONPATH accordingly 229N/A # to a Python 2.4 or 2.6 environment # Go through each property in short_option_props and, if its value is # set to something other than "", add the appropriate command line # flag and argument to the string. echo "service property pkg/$o not defined for" \
# If the SMF property is set to something other than 'none', add # the flag and its argument to the command. if [[
$val !=
'""' ]];
then # Go through each property in long_option_props and, if its value is # set to something other than "", add the appropriate command line # flag and argument to the string. echo "service property pkg/$o not defined for" \
if [[
$val !=
'""' ]];
then # In order to run in mdns mode, we need to append the --llmirror # flag to the list of command options. Do that last, here. # Build the command to start pkg.depotd with the specified options. # 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 }"