xref: /illumos-gate/usr/src/cmd/svc/milestone/net-nwam (revision d71dbb732372504daff1f1783bc0d8864ce9bd50)
1*d71dbb73Sjbeck#!/sbin/sh
2*d71dbb73Sjbeck#
3*d71dbb73Sjbeck# CDDL HEADER START
4*d71dbb73Sjbeck#
5*d71dbb73Sjbeck# The contents of this file are subject to the terms of the
6*d71dbb73Sjbeck# Common Development and Distribution License (the "License").
7*d71dbb73Sjbeck# You may not use this file except in compliance with the License.
8*d71dbb73Sjbeck#
9*d71dbb73Sjbeck# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*d71dbb73Sjbeck# or http://www.opensolaris.org/os/licensing.
11*d71dbb73Sjbeck# See the License for the specific language governing permissions
12*d71dbb73Sjbeck# and limitations under the License.
13*d71dbb73Sjbeck#
14*d71dbb73Sjbeck# When distributing Covered Code, include this CDDL HEADER in each
15*d71dbb73Sjbeck# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*d71dbb73Sjbeck# If applicable, add the following below this CDDL HEADER, with the
17*d71dbb73Sjbeck# fields enclosed by brackets "[]" replaced with your own identifying
18*d71dbb73Sjbeck# information: Portions Copyright [yyyy] [name of copyright owner]
19*d71dbb73Sjbeck#
20*d71dbb73Sjbeck# CDDL HEADER END
21*d71dbb73Sjbeck#
22*d71dbb73Sjbeck#
23*d71dbb73Sjbeck# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*d71dbb73Sjbeck# Use is subject to license terms.
25*d71dbb73Sjbeck#
26*d71dbb73Sjbeck
27*d71dbb73Sjbeck#ident	"%Z%%M%	%I%	%E% SMI"
28*d71dbb73Sjbeck
29*d71dbb73Sjbeck. /lib/svc/share/smf_include.sh
30*d71dbb73Sjbeck
31*d71dbb73Sjbeck#
32*d71dbb73Sjbeck# In a shared-IP zone we need this service to be up, but all of the work
33*d71dbb73Sjbeck# it tries to do is irrelevant (and will actually lead to the service
34*d71dbb73Sjbeck# failing if we try to do it), so just bail out.
35*d71dbb73Sjbeck# In the global zone and exclusive-IP zones we proceed.
36*d71dbb73Sjbeck#
37*d71dbb73Sjbecksmf_configure_ip || exit $SMF_EXIT_OK
38*d71dbb73Sjbeck
39*d71dbb73Sjbeckcase "$1" in
40*d71dbb73Sjbeck'refresh')
41*d71dbb73Sjbeck	/usr/bin/pkill -HUP -z `smf_zonename` nwamd
42*d71dbb73Sjbeck	;;
43*d71dbb73Sjbeck
44*d71dbb73Sjbeck'start')
45*d71dbb73Sjbeck	if smf_is_globalzone; then
46*d71dbb73Sjbeck		# Initialize security objects.
47*d71dbb73Sjbeck		/sbin/dladm init-secobj
48*d71dbb73Sjbeck	fi
49*d71dbb73Sjbeck	# start nwamd in foreground; it will daemonize itself
50*d71dbb73Sjbeck	if /lib/inet/nwamd ; then
51*d71dbb73Sjbeck		exit $SMF_EXIT_OK
52*d71dbb73Sjbeck	else
53*d71dbb73Sjbeck		exit $SMF_EXIT_ERR_FATAL
54*d71dbb73Sjbeck	fi
55*d71dbb73Sjbeck	;;
56*d71dbb73Sjbeck
57*d71dbb73Sjbeck'stop')
58*d71dbb73Sjbeck	/usr/bin/pkill -z `smf_zonename` nwamd
59*d71dbb73Sjbeck	;;
60*d71dbb73Sjbeck
61*d71dbb73Sjbeck*)
62*d71dbb73Sjbeck	echo "Usage: $0 { start | stop | refresh }"
63*d71dbb73Sjbeck	exit $SMF_EXIT_ERR_FATAL
64*d71dbb73Sjbeck	;;
65*d71dbb73Sjbeckesac
66*d71dbb73Sjbeckexit $SMF_EXIT_OK
67