svc-syseventd revision 1948:e6ff65bd0519
142645Sjdp#!/sbin/sh
242645Sjdp#
378161Speter# CDDL HEADER START
442645Sjdp#
542645Sjdp# The contents of this file are subject to the terms of the
642645Sjdp# Common Development and Distribution License (the "License").
742645Sjdp# You may not use this file except in compliance with the License.
842645Sjdp#
942645Sjdp# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1042645Sjdp# or http://www.opensolaris.org/os/licensing.
1142645Sjdp# See the License for the specific language governing permissions
1242645Sjdp# and limitations under the License.
1342645Sjdp#
1442645Sjdp# When distributing Covered Code, include this CDDL HEADER in each
1542645Sjdp# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1642645Sjdp# If applicable, add the following below this CDDL HEADER, with the
1742645Sjdp# fields enclosed by brackets "[]" replaced with your own identifying
1842645Sjdp# information: Portions Copyright [yyyy] [name of copyright owner]
1942645Sjdp#
2042645Sjdp# CDDL HEADER END
2142645Sjdp#
2242645Sjdp#
2342645Sjdp# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
2442645Sjdp# Use is subject to license terms.
2542645Sjdp#
2642645Sjdp#ident	"%Z%%M%	%I%	%E% SMI"
2750477Speter
2842645Sjdp. /lib/svc/share/smf_include.sh
2942645Sjdp
3042645Sjdpcase "$1" in
3142645Sjdp'start')
3242645Sjdp	if /usr/lib/sysevent/syseventd >/dev/msglog 2>&1; then :; else
3342645Sjdp		exit
3442645Sjdp	fi
3578161Speter	;;
3642645Sjdp
3742645Sjdp#
3878161Speter# devfsadmd and syseventconfd are started on-demand
3978161Speter# by syseventd. syseventd should be stopped before devfsadm and syseventconfd.
4078161Speter#
4178161Speter'stop')
4278161Speter	dpid=`/usr/bin/pgrep devfsadm`
4378161Speter	scpid=`/usr/bin/pgrep syseventconfd`
4478161Speter	spid=`/usr/bin/pgrep syseventd`
4595200Smarkm	zone=`smf_zonename`
4678161Speter	/usr/bin/pkill -x -u 0 -P 1 -z $zone rcm_daemon
4778161Speter	/usr/bin/pkill -x -u 0 -P 1 -z $zone syseventd
4878161Speter	/usr/bin/pkill -x -u 0 -P 1 -z $zone devfsadm
4978161Speter	/usr/bin/pkill -x -u 0 -P 1 -z $zone syseventconfd
5078161Speter
5178161Speter	#
5278161Speter	# Since pkill is not atomic (may miss forking processes), also
5378161Speter	# kill entire service contract.
5495200Smarkm	#
5595200Smarkm	smf_kill_contract $2 TERM 1
5695200Smarkm	[ $? -ne 0 ] && exit 1
5795200Smarkm	;;	
5895200Smarkm
5995200Smarkm*)
6078161Speter	echo "Usage: $0 { start | stop }"
6178161Speter	exit 1
6278161Speter	;;
6378161Speter
6478161Speteresac
6578161Speterexit 0
6678161Speter