xref: /onnv-gate/usr/src/cmd/lp/cmd/lpsched/print-svc (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!/sbin/sh
2*0Sstevel@tonic-gate#
3*0Sstevel@tonic-gate# CDDL HEADER START
4*0Sstevel@tonic-gate#
5*0Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*0Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
7*0Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
8*0Sstevel@tonic-gate# with the License.
9*0Sstevel@tonic-gate#
10*0Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11*0Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
12*0Sstevel@tonic-gate# See the License for the specific language governing permissions
13*0Sstevel@tonic-gate# and limitations under the License.
14*0Sstevel@tonic-gate#
15*0Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
16*0Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17*0Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
18*0Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
19*0Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
20*0Sstevel@tonic-gate#
21*0Sstevel@tonic-gate# CDDL HEADER END
22*0Sstevel@tonic-gate#
23*0Sstevel@tonic-gate#
24*0Sstevel@tonic-gate# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
25*0Sstevel@tonic-gate# Use is subject to license terms.
26*0Sstevel@tonic-gate#
27*0Sstevel@tonic-gate#
28*0Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
29*0Sstevel@tonic-gate#
30*0Sstevel@tonic-gate
31*0Sstevel@tonic-gate. /lib/svc/share/smf_include.sh
32*0Sstevel@tonic-gate
33*0Sstevel@tonic-gateSVC="svc:/application/print/server"
34*0Sstevel@tonic-gateINS="svc:/application/print/server:default"
35*0Sstevel@tonic-gate
36*0Sstevel@tonic-gatecase "$1" in
37*0Sstevel@tonic-gate'start')
38*0Sstevel@tonic-gate
39*0Sstevel@tonic-gateisopts=`/usr/sbin/svccfg <<-EOF
40*0Sstevel@tonic-gate	select ${INS}
41*0Sstevel@tonic-gate	listpg cmd_opts
42*0Sstevel@tonic-gate
43*0Sstevel@tonic-gate	EOF`
44*0Sstevel@tonic-gate
45*0Sstevel@tonic-gateif [ "$isopts" ] ; then
46*0Sstevel@tonic-gate
47*0Sstevel@tonic-gate#called by /usr/lib/lpsched; use cmd_opts properties only
48*0Sstevel@tonic-gate
49*0Sstevel@tonic-gate	num_notifiers=`/bin/svcprop -p cmd_opts/num_notifiers ${INS}`
50*0Sstevel@tonic-gate
51*0Sstevel@tonic-gate	if [ "$num_notifiers" != "" ] ; then
52*0Sstevel@tonic-gate		OPTS="$OPTS -n $num_notifiers" 
53*0Sstevel@tonic-gate	fi
54*0Sstevel@tonic-gate
55*0Sstevel@tonic-gate	num_filters=`/bin/svcprop -p cmd_opts/num_filters ${INS}`
56*0Sstevel@tonic-gate
57*0Sstevel@tonic-gate	if [ "$num_filters" != "" ]  ; then
58*0Sstevel@tonic-gate		OPTS="$OPTS -f $num_filters"
59*0Sstevel@tonic-gate	fi
60*0Sstevel@tonic-gate
61*0Sstevel@tonic-gate	fd_limit=`/bin/svcprop -p cmd_opts/fd_limit ${INS}`
62*0Sstevel@tonic-gate
63*0Sstevel@tonic-gate	if [ "$fd_limit" != "" ]  ; then
64*0Sstevel@tonic-gate		OPTS="$OPTS -p $fd_limit"
65*0Sstevel@tonic-gate	fi
66*0Sstevel@tonic-gate
67*0Sstevel@tonic-gate	reserved_fds=`/bin/svcprop -p cmd_opts/reserved_fds ${INS}`
68*0Sstevel@tonic-gate
69*0Sstevel@tonic-gate	if [ "$reserved_fds" != "" ] ; then
70*0Sstevel@tonic-gate		OPTS="$OPTS -r $reserved_fds"
71*0Sstevel@tonic-gate	fi
72*0Sstevel@tonic-gate
73*0Sstevel@tonic-gate# clear out cmd_opts property group
74*0Sstevel@tonic-gate
75*0Sstevel@tonic-gate	svccfg <<-EOF
76*0Sstevel@tonic-gate	select ${INS}
77*0Sstevel@tonic-gate	delpg cmd_opts
78*0Sstevel@tonic-gate
79*0Sstevel@tonic-gate	EOF
80*0Sstevel@tonic-gate
81*0Sstevel@tonic-gateelse
82*0Sstevel@tonic-gate
83*0Sstevel@tonic-gate# We are here through enable; use lpsched properties
84*0Sstevel@tonic-gate# Check for saved properties
85*0Sstevel@tonic-gate
86*0Sstevel@tonic-gate	num_notifiers=`/bin/svcprop -p lpsched/num_notifiers ${SVC}`
87*0Sstevel@tonic-gate	if [ "$num_notifiers" != "" ] && [ "$num_notifiers" != "0" ] ; then
88*0Sstevel@tonic-gate		OPTS="$OPTS -n $num_notifiers"
89*0Sstevel@tonic-gate	fi
90*0Sstevel@tonic-gate
91*0Sstevel@tonic-gate	num_filters=`/bin/svcprop -p lpsched/num_filters ${SVC}`
92*0Sstevel@tonic-gate	if [ "$num_filters" != "" ] && [ "$num_filters" != "0" ] ; then
93*0Sstevel@tonic-gate		OPTS="$OPTS -f $num_filters"
94*0Sstevel@tonic-gate	fi
95*0Sstevel@tonic-gate
96*0Sstevel@tonic-gate	fd_limit=`/bin/svcprop -p lpsched/fd_limit ${SVC}`
97*0Sstevel@tonic-gate	if [ "$fd_limit" != "" ]  && [ "$fd_limit" != "0" ]; then
98*0Sstevel@tonic-gate		OPTS="$OPTS -p $fd_limit"
99*0Sstevel@tonic-gate	fi
100*0Sstevel@tonic-gate
101*0Sstevel@tonic-gate	reserved_fds=`/bin/svcprop -p lpsched/reserved_fds ${SVC}`
102*0Sstevel@tonic-gate	if [ "$reserved_fds" != "" ] && [ "$reserved_fds" != "0" ] ; then
103*0Sstevel@tonic-gate		OPTS="$OPTS -r $reserved_fds"
104*0Sstevel@tonic-gate	fi
105*0Sstevel@tonic-gatefi
106*0Sstevel@tonic-gate
107*0Sstevel@tonic-gate# set temporary or permanent properties from OPTS
108*0Sstevel@tonic-gate
109*0Sstevel@tonic-gate	[ -f /usr/lib/lp/local/lpsched ] || exit $SMF_EXIT_ERR_CONFIG
110*0Sstevel@tonic-gate
111*0Sstevel@tonic-gate	/usr/lib/lp/local/lpsched ${OPTS}
112*0Sstevel@tonic-gate
113*0Sstevel@tonic-gate	;;
114*0Sstevel@tonic-gate
115*0Sstevel@tonic-gate'stop')
116*0Sstevel@tonic-gate	[ -f /usr/lib/lp/local/lpshut ] || exit $SMF_EXIT_ERR_CONFIG
117*0Sstevel@tonic-gate
118*0Sstevel@tonic-gate	/usr/lib/lp/local/lpshut
119*0Sstevel@tonic-gate	;;
120*0Sstevel@tonic-gate
121*0Sstevel@tonic-gate*)
122*0Sstevel@tonic-gate	echo "Usage: $0 { start | stop }"
123*0Sstevel@tonic-gate	exit 1
124*0Sstevel@tonic-gate	;;
125*0Sstevel@tonic-gateesac
126*0Sstevel@tonic-gateexit $SMF_EXIT_OK
127