xref: /titanic_51/usr/src/cmd/nscd/svc-nscd (revision bf1e3bee1b13b3a914f0dd817a04f6e0ce8e0691)
17c478bd9Sstevel@tonic-gate#!/sbin/sh
27c478bd9Sstevel@tonic-gate#
345916cd2Sjpk#
47c478bd9Sstevel@tonic-gate# CDDL HEADER START
57c478bd9Sstevel@tonic-gate#
67c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
745916cd2Sjpk# Common Development and Distribution License (the "License").
845916cd2Sjpk# You may not use this file except in compliance with the License.
97c478bd9Sstevel@tonic-gate#
107c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
117c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
127c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
137c478bd9Sstevel@tonic-gate# and limitations under the License.
147c478bd9Sstevel@tonic-gate#
157c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
167c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
177c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
187c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
197c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate# CDDL HEADER END
227c478bd9Sstevel@tonic-gate#
23cb5caa98Sdjl#
24*bf1e3beeSmichen# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
257c478bd9Sstevel@tonic-gate# Use is subject to license terms.
267c478bd9Sstevel@tonic-gate#
277c478bd9Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gate. /lib/svc/share/smf_include.sh
307c478bd9Sstevel@tonic-gate
3145916cd2Sjpk# Trusted Extensions non-global zones need special handling
3245916cd2Sjpk
3345916cd2Sjpkif (smf_is_system_labeled); then
3445916cd2Sjpk	if (smf_is_nonglobalzone); then
35*bf1e3beeSmichen		if [ ! -f /var/tsol/doors/nscd_per_label ]; then
3645916cd2Sjpk
3745916cd2Sjpk        		# If needed create a door to the global zone daemon.
38*bf1e3beeSmichen        		if [ -r /var/run/name_service_door ]; then
39*bf1e3beeSmichen				rm /var/run/name_service_door
4045916cd2Sjpk        		fi
41*bf1e3beeSmichen                	ln -s /var/tsol/doors/name_service_door  \
42*bf1e3beeSmichen				/var/run || exit $SMF_EXIT_ERR_FATAL
4345916cd2Sjpk
44*bf1e3beeSmichen        		# If current service duration is not "transient",
45*bf1e3beeSmichen        		# create a dummy background process to preserve
46*bf1e3beeSmichen			# contract lifetime.
4745916cd2Sjpk        		duration=""
48*bf1e3beeSmichen        		if /bin/svcprop -q -c -p startd/duration $SMF_FMRI
49*bf1e3beeSmichen			    then
50*bf1e3beeSmichen                		duration=`/bin/svcprop -c -p startd/duration  \
51*bf1e3beeSmichen					$SMF_FMRI`
5245916cd2Sjpk        		fi
5345916cd2Sjpk        		if [ "$duration" != "transient" ]; then
5445916cd2Sjpk                		( while true ; do sleep 3600 ; done ) &
5545916cd2Sjpk        		fi
5645916cd2Sjpk
5745916cd2Sjpk        		# The real daemon is not started in non-global zones,
5845916cd2Sjpk			# so exit now.
5945916cd2Sjpk        		exit $SMF_EXIT_OK
60*bf1e3beeSmichen		else
61*bf1e3beeSmichen        		# remove the door to the global zone daemon
62*bf1e3beeSmichen        		if [ -L /var/run/name_service_door ]; then
63*bf1e3beeSmichen                		rm /var/run/name_service_door
6445916cd2Sjpk        		fi
65*bf1e3beeSmichen		fi
66*bf1e3beeSmichen	fi
6745916cd2Sjpkfi
6845916cd2Sjpk
697c478bd9Sstevel@tonic-gateif [ -f /etc/nscd.conf -a -f /usr/sbin/nscd ]; then
70cb5caa98Sdjl	/usr/sbin/nscd < /dev/null > /dev/msglog 2>&1 &
717c478bd9Sstevel@tonic-gateelse
727c478bd9Sstevel@tonic-gate	echo "No /etc/nscd.conf or no /usr/sbin/nscd"
737c478bd9Sstevel@tonic-gate	exit $SMF_EXIT_ERR_CONFIG
747c478bd9Sstevel@tonic-gatefi
75