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