xref: /illumos-gate/usr/src/cmd/hotplugd/svc-hotplug (revision bbf21555)
126947304SEvan Yan#!/sbin/sh
226947304SEvan Yan#
326947304SEvan Yan# CDDL HEADER START
426947304SEvan Yan#
526947304SEvan Yan# The contents of this file are subject to the terms of the
626947304SEvan Yan# Common Development and Distribution License (the "License").
726947304SEvan Yan# You may not use this file except in compliance with the License.
826947304SEvan Yan#
926947304SEvan Yan# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1026947304SEvan Yan# or http://www.opensolaris.org/os/licensing.
1126947304SEvan Yan# See the License for the specific language governing permissions
1226947304SEvan Yan# and limitations under the License.
1326947304SEvan Yan#
1426947304SEvan Yan# When distributing Covered Code, include this CDDL HEADER in each
1526947304SEvan Yan# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1626947304SEvan Yan# If applicable, add the following below this CDDL HEADER, with the
1726947304SEvan Yan# fields enclosed by brackets "[]" replaced with your own identifying
1826947304SEvan Yan# information: Portions Copyright [yyyy] [name of copyright owner]
1926947304SEvan Yan#
2026947304SEvan Yan# CDDL HEADER END
2126947304SEvan Yan#
2226947304SEvan Yan
2326947304SEvan Yan#
2426947304SEvan Yan# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
2526947304SEvan Yan# Use is subject to license terms.
2626947304SEvan Yan#
2726947304SEvan Yan
2826947304SEvan Yan#
29*bbf21555SRichard Lowe# Startup script for the hotplugd(8) daemon.
3026947304SEvan Yan#
3126947304SEvan Yan
3226947304SEvan Yan. /lib/svc/share/smf_include.sh
3326947304SEvan Yan
3426947304SEvan YanHOTPLUGD_DOOR=/var/run/hotplugd_door
3526947304SEvan Yan
3626947304SEvan Yan# The hotplug service is only supported in the global zone.
3726947304SEvan Yanif smf_is_nonglobalzone; then
3826947304SEvan Yan	/usr/sbin/svcadm disable $SMF_FMRI
3926947304SEvan Yan	echo "$SMF_FMRI is not supported in a local zone"
4026947304SEvan Yan	sleep 5 &
4126947304SEvan Yan	exit $SMF_EXIT_OK
4226947304SEvan Yanfi
4326947304SEvan Yan
4426947304SEvan Yan# If a hotplug door exists, check for a hotplugd process and exit
4526947304SEvan Yan# if the daemon is already running.
4626947304SEvan Yanif [ -f $HOTPLUGD_DOOR ]; then
4726947304SEvan Yan	if /usr/bin/pgrep -x -u 0 hotplugd >/dev/null 2>&1; then
4826947304SEvan Yan		echo "$0: hotplugd is already running"
4926947304SEvan Yan		exit 1
5026947304SEvan Yan	fi
5126947304SEvan Yanfi
5226947304SEvan Yan
5326947304SEvan Yanrm -f $HOTPLUGD_DOOR
5426947304SEvan Yanexec /usr/lib/hotplugd
55