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