xref: /titanic_44/usr/src/cmd/hotplugd/svc-hotplug (revision 269473047d747f7815af570197e4ef7322d3632c)
1*26947304SEvan Yan#!/sbin/sh
2*26947304SEvan Yan#
3*26947304SEvan Yan# CDDL HEADER START
4*26947304SEvan Yan#
5*26947304SEvan Yan# The contents of this file are subject to the terms of the
6*26947304SEvan Yan# Common Development and Distribution License (the "License").
7*26947304SEvan Yan# You may not use this file except in compliance with the License.
8*26947304SEvan Yan#
9*26947304SEvan Yan# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*26947304SEvan Yan# or http://www.opensolaris.org/os/licensing.
11*26947304SEvan Yan# See the License for the specific language governing permissions
12*26947304SEvan Yan# and limitations under the License.
13*26947304SEvan Yan#
14*26947304SEvan Yan# When distributing Covered Code, include this CDDL HEADER in each
15*26947304SEvan Yan# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*26947304SEvan Yan# If applicable, add the following below this CDDL HEADER, with the
17*26947304SEvan Yan# fields enclosed by brackets "[]" replaced with your own identifying
18*26947304SEvan Yan# information: Portions Copyright [yyyy] [name of copyright owner]
19*26947304SEvan Yan#
20*26947304SEvan Yan# CDDL HEADER END
21*26947304SEvan Yan#
22*26947304SEvan Yan
23*26947304SEvan Yan#
24*26947304SEvan Yan# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
25*26947304SEvan Yan# Use is subject to license terms.
26*26947304SEvan Yan#
27*26947304SEvan Yan
28*26947304SEvan Yan#
29*26947304SEvan Yan# Startup script for the hotplugd(1M) daemon.
30*26947304SEvan Yan#
31*26947304SEvan Yan
32*26947304SEvan Yan. /lib/svc/share/smf_include.sh
33*26947304SEvan Yan
34*26947304SEvan YanHOTPLUGD_DOOR=/var/run/hotplugd_door
35*26947304SEvan Yan
36*26947304SEvan Yan# The hotplug service is only supported in the global zone.
37*26947304SEvan Yanif smf_is_nonglobalzone; then
38*26947304SEvan Yan	/usr/sbin/svcadm disable $SMF_FMRI
39*26947304SEvan Yan	echo "$SMF_FMRI is not supported in a local zone"
40*26947304SEvan Yan	sleep 5 &
41*26947304SEvan Yan	exit $SMF_EXIT_OK
42*26947304SEvan Yanfi
43*26947304SEvan Yan
44*26947304SEvan Yan# If a hotplug door exists, check for a hotplugd process and exit
45*26947304SEvan Yan# if the daemon is already running.
46*26947304SEvan Yanif [ -f $HOTPLUGD_DOOR ]; then
47*26947304SEvan Yan	if /usr/bin/pgrep -x -u 0 hotplugd >/dev/null 2>&1; then
48*26947304SEvan Yan		echo "$0: hotplugd is already running"
49*26947304SEvan Yan		exit 1
50*26947304SEvan Yan	fi
51*26947304SEvan Yanfi
52*26947304SEvan Yan
53*26947304SEvan Yanrm -f $HOTPLUGD_DOOR
54*26947304SEvan Yanexec /usr/lib/hotplugd
55