xref: /onnv-gate/usr/src/cmd/nscd/svc-nscd (revision 4795:f3a013161d81)
10Sstevel@tonic-gate#!/sbin/sh
20Sstevel@tonic-gate#
31676Sjpk#
40Sstevel@tonic-gate# CDDL HEADER START
50Sstevel@tonic-gate#
60Sstevel@tonic-gate# The contents of this file are subject to the terms of the
71676Sjpk# Common Development and Distribution License (the "License").
81676Sjpk# You may not use this file except in compliance with the License.
90Sstevel@tonic-gate#
100Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
110Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
120Sstevel@tonic-gate# See the License for the specific language governing permissions
130Sstevel@tonic-gate# and limitations under the License.
140Sstevel@tonic-gate#
150Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
160Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
170Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
180Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
190Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
200Sstevel@tonic-gate#
210Sstevel@tonic-gate# CDDL HEADER END
220Sstevel@tonic-gate#
232830Sdjl#
24*4795Smichen# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
250Sstevel@tonic-gate# Use is subject to license terms.
260Sstevel@tonic-gate#
270Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
280Sstevel@tonic-gate
290Sstevel@tonic-gate. /lib/svc/share/smf_include.sh
300Sstevel@tonic-gate
311676Sjpk# Trusted Extensions non-global zones need special handling
321676Sjpk
331676Sjpkif (smf_is_system_labeled); then
341676Sjpk	if (smf_is_nonglobalzone); then
35*4795Smichen		if [ ! -f /var/tsol/doors/nscd_per_label ]; then
361676Sjpk
37*4795Smichen        		# If needed create a door to the global zone daemon.
38*4795Smichen        		if [ -r /var/run/name_service_door ]; then
39*4795Smichen				rm /var/run/name_service_door
40*4795Smichen        		fi
41*4795Smichen                	ln -s /var/tsol/doors/name_service_door  \
42*4795Smichen				/var/run || exit $SMF_EXIT_ERR_FATAL
431676Sjpk
44*4795Smichen        		# If current service duration is not "transient",
45*4795Smichen        		# create a dummy background process to preserve
46*4795Smichen			# contract lifetime.
47*4795Smichen        		duration=""
48*4795Smichen        		if /bin/svcprop -q -c -p startd/duration $SMF_FMRI
49*4795Smichen			    then
50*4795Smichen                		duration=`/bin/svcprop -c -p startd/duration  \
51*4795Smichen					$SMF_FMRI`
52*4795Smichen        		fi
53*4795Smichen        		if [ "$duration" != "transient" ]; then
54*4795Smichen                		( while true ; do sleep 3600 ; done ) &
55*4795Smichen        		fi
561676Sjpk
57*4795Smichen        		# The real daemon is not started in non-global zones,
58*4795Smichen			# so exit now.
59*4795Smichen        		exit $SMF_EXIT_OK
60*4795Smichen		else
61*4795Smichen        		# remove the door to the global zone daemon
62*4795Smichen        		if [ -L /var/run/name_service_door ]; then
63*4795Smichen                		rm /var/run/name_service_door
64*4795Smichen        		fi
65*4795Smichen		fi
661676Sjpk	fi
671676Sjpkfi
681676Sjpk
690Sstevel@tonic-gateif [ -f /etc/nscd.conf -a -f /usr/sbin/nscd ]; then
702830Sdjl	/usr/sbin/nscd < /dev/null > /dev/msglog 2>&1 &
710Sstevel@tonic-gateelse
720Sstevel@tonic-gate	echo "No /etc/nscd.conf or no /usr/sbin/nscd"
730Sstevel@tonic-gate	exit $SMF_EXIT_ERR_CONFIG
740Sstevel@tonic-gatefi
75