xref: /onnv-gate/usr/src/cmd/lp/cmd/lpsched/print-svc (revision 2589:bab6bd68d0e5)
10Sstevel@tonic-gate#!/sbin/sh
20Sstevel@tonic-gate#
30Sstevel@tonic-gate# CDDL HEADER START
40Sstevel@tonic-gate#
50Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*2589Shshaw# Common Development and Distribution License (the "License").
7*2589Shshaw# You may not use this file except in compliance with the License.
80Sstevel@tonic-gate#
90Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate# See the License for the specific language governing permissions
120Sstevel@tonic-gate# and limitations under the License.
130Sstevel@tonic-gate#
140Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate#
200Sstevel@tonic-gate# CDDL HEADER END
210Sstevel@tonic-gate#
220Sstevel@tonic-gate#
23*2589Shshaw# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate# Use is subject to license terms.
250Sstevel@tonic-gate#
260Sstevel@tonic-gate#
270Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
280Sstevel@tonic-gate#
290Sstevel@tonic-gate
300Sstevel@tonic-gate. /lib/svc/share/smf_include.sh
310Sstevel@tonic-gate
32*2589Shshaw# SERVICE = parent service name
33*2589ShshawSERVICE=`echo $SMF_FMRI | /usr/sbin/cut -f1,2 -d":"`
340Sstevel@tonic-gate
350Sstevel@tonic-gatecase "$1" in
360Sstevel@tonic-gate'start')
370Sstevel@tonic-gate
380Sstevel@tonic-gateisopts=`/usr/sbin/svccfg <<-EOF
39*2589Shshaw	select $SMF_FMRI
400Sstevel@tonic-gate	listpg cmd_opts
410Sstevel@tonic-gate
420Sstevel@tonic-gate	EOF`
430Sstevel@tonic-gate
440Sstevel@tonic-gateif [ "$isopts" ] ; then
450Sstevel@tonic-gate
460Sstevel@tonic-gate#called by /usr/lib/lpsched; use cmd_opts properties only
470Sstevel@tonic-gate
48*2589Shshaw	num_notifiers=`/bin/svcprop -p cmd_opts/num_notifiers $SMF_FMRI`
490Sstevel@tonic-gate
500Sstevel@tonic-gate	if [ "$num_notifiers" != "" ] ; then
510Sstevel@tonic-gate		OPTS="$OPTS -n $num_notifiers" 
520Sstevel@tonic-gate	fi
530Sstevel@tonic-gate
54*2589Shshaw	num_filters=`/bin/svcprop -p cmd_opts/num_filters $SMF_FMRI`
550Sstevel@tonic-gate
560Sstevel@tonic-gate	if [ "$num_filters" != "" ]  ; then
570Sstevel@tonic-gate		OPTS="$OPTS -f $num_filters"
580Sstevel@tonic-gate	fi
590Sstevel@tonic-gate
60*2589Shshaw	fd_limit=`/bin/svcprop -p cmd_opts/fd_limit $SMF_FMRI`
610Sstevel@tonic-gate
620Sstevel@tonic-gate	if [ "$fd_limit" != "" ]  ; then
630Sstevel@tonic-gate		OPTS="$OPTS -p $fd_limit"
640Sstevel@tonic-gate	fi
650Sstevel@tonic-gate
66*2589Shshaw	reserved_fds=`/bin/svcprop -p cmd_opts/reserved_fds $SMF_FMRI`
670Sstevel@tonic-gate
680Sstevel@tonic-gate	if [ "$reserved_fds" != "" ] ; then
690Sstevel@tonic-gate		OPTS="$OPTS -r $reserved_fds"
700Sstevel@tonic-gate	fi
710Sstevel@tonic-gate
720Sstevel@tonic-gate# clear out cmd_opts property group
730Sstevel@tonic-gate
740Sstevel@tonic-gate	svccfg <<-EOF
75*2589Shshaw	select $SMF_FMRI
760Sstevel@tonic-gate	delpg cmd_opts
770Sstevel@tonic-gate
780Sstevel@tonic-gate	EOF
790Sstevel@tonic-gate
800Sstevel@tonic-gateelse
810Sstevel@tonic-gate
820Sstevel@tonic-gate# We are here through enable; use lpsched properties
830Sstevel@tonic-gate# Check for saved properties
840Sstevel@tonic-gate
85*2589Shshaw	num_notifiers=`/bin/svcprop -p lpsched/num_notifiers $SERVICE`
860Sstevel@tonic-gate	if [ "$num_notifiers" != "" ] && [ "$num_notifiers" != "0" ] ; then
870Sstevel@tonic-gate		OPTS="$OPTS -n $num_notifiers"
880Sstevel@tonic-gate	fi
890Sstevel@tonic-gate
90*2589Shshaw	num_filters=`/bin/svcprop -p lpsched/num_filters $SERVICE`
910Sstevel@tonic-gate	if [ "$num_filters" != "" ] && [ "$num_filters" != "0" ] ; then
920Sstevel@tonic-gate		OPTS="$OPTS -f $num_filters"
930Sstevel@tonic-gate	fi
940Sstevel@tonic-gate
95*2589Shshaw	fd_limit=`/bin/svcprop -p lpsched/fd_limit $SERVICE`
960Sstevel@tonic-gate	if [ "$fd_limit" != "" ]  && [ "$fd_limit" != "0" ]; then
970Sstevel@tonic-gate		OPTS="$OPTS -p $fd_limit"
980Sstevel@tonic-gate	fi
990Sstevel@tonic-gate
100*2589Shshaw	reserved_fds=`/bin/svcprop -p lpsched/reserved_fds $SERVICE`
1010Sstevel@tonic-gate	if [ "$reserved_fds" != "" ] && [ "$reserved_fds" != "0" ] ; then
1020Sstevel@tonic-gate		OPTS="$OPTS -r $reserved_fds"
1030Sstevel@tonic-gate	fi
1040Sstevel@tonic-gatefi
1050Sstevel@tonic-gate
1060Sstevel@tonic-gate# set temporary or permanent properties from OPTS
1070Sstevel@tonic-gate
1080Sstevel@tonic-gate	[ -f /usr/lib/lp/local/lpsched ] || exit $SMF_EXIT_ERR_CONFIG
1090Sstevel@tonic-gate
1100Sstevel@tonic-gate	/usr/lib/lp/local/lpsched ${OPTS}
1110Sstevel@tonic-gate
1120Sstevel@tonic-gate	;;
1130Sstevel@tonic-gate
1140Sstevel@tonic-gate'stop')
1150Sstevel@tonic-gate	[ -f /usr/lib/lp/local/lpshut ] || exit $SMF_EXIT_ERR_CONFIG
1160Sstevel@tonic-gate
1170Sstevel@tonic-gate	/usr/lib/lp/local/lpshut
1180Sstevel@tonic-gate	;;
1190Sstevel@tonic-gate
1200Sstevel@tonic-gate*)
1210Sstevel@tonic-gate	echo "Usage: $0 { start | stop }"
1220Sstevel@tonic-gate	exit 1
1230Sstevel@tonic-gate	;;
1240Sstevel@tonic-gateesac
1250Sstevel@tonic-gateexit $SMF_EXIT_OK
126