xref: /illumos-gate/usr/src/cmd/nscd/svc-nscd (revision cb5caa98562cf06753163f558cbcfe30b8f4673a)
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#
23*cb5caa98Sdjl#
2445916cd2Sjpk# Copyright 2006 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
3545916cd2Sjpk
3645916cd2Sjpk        	# If needed create a door to the global zone daemon.
3745916cd2Sjpk        	if [ ! -L /var/run/name_service_door ]; then
3845916cd2Sjpk                	ln -s /var/tsol/doors/name_service_door /var/run || \
3945916cd2Sjpk                    	exit $SMF_EXIT_ERR_FATAL
4045916cd2Sjpk        	fi
4145916cd2Sjpk
4245916cd2Sjpk        	# If current service duration is not "transient", create
4345916cd2Sjpk        	# a dummy background process to preserve contract lifetime.
4445916cd2Sjpk        	duration=""
4545916cd2Sjpk        	if /bin/svcprop -q -c -p startd/duration $SMF_FMRI ; then
4645916cd2Sjpk                	duration=`/bin/svcprop -c -p startd/duration $SMF_FMRI`
4745916cd2Sjpk        	fi
4845916cd2Sjpk        	if [ "$duration" != "transient" ]; then
4945916cd2Sjpk                	( while true ; do sleep 3600 ; done ) &
5045916cd2Sjpk        	fi
5145916cd2Sjpk
5245916cd2Sjpk        	# The real daemon is not started in non-global zones,
5345916cd2Sjpk		# so exit now.
5445916cd2Sjpk        	exit $SMF_EXIT_OK
5545916cd2Sjpk	fi
5645916cd2Sjpk
5745916cd2Sjpkfi
5845916cd2Sjpk
597c478bd9Sstevel@tonic-gateif [ -f /etc/nscd.conf -a -f /usr/sbin/nscd ]; then
60*cb5caa98Sdjl	/usr/sbin/nscd < /dev/null > /dev/msglog 2>&1 &
617c478bd9Sstevel@tonic-gateelse
627c478bd9Sstevel@tonic-gate	echo "No /etc/nscd.conf or no /usr/sbin/nscd"
637c478bd9Sstevel@tonic-gate	exit $SMF_EXIT_ERR_CONFIG
647c478bd9Sstevel@tonic-gatefi
65