print-svc revision 0a44ef6d9afbfe052a7e975f55ea0d2954b62a82
#!/sbin/sh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# ident "%Z%%M% %I% %E% SMI"
#
. /lib/svc/share/smf_include.sh
# SERVICE = parent service name
SERVICE=`echo $SMF_FMRI | /usr/bin/cut -f1,2 -d":"`
case "$1" in
'start')
isopts=`/usr/sbin/svccfg <<-EOF
select $SMF_FMRI
listpg cmd_opts
EOF`
if [ "$isopts" ] ; then
#called by /usr/lib/lpsched; use cmd_opts properties only
num_notifiers=`/bin/svcprop -p cmd_opts/num_notifiers $SMF_FMRI`
if [ "$num_notifiers" != "" ] ; then
OPTS="$OPTS -n $num_notifiers"
fi
num_filters=`/bin/svcprop -p cmd_opts/num_filters $SMF_FMRI`
if [ "$num_filters" != "" ] ; then
OPTS="$OPTS -f $num_filters"
fi
fd_limit=`/bin/svcprop -p cmd_opts/fd_limit $SMF_FMRI`
if [ "$fd_limit" != "" ] ; then
OPTS="$OPTS -p $fd_limit"
fi
reserved_fds=`/bin/svcprop -p cmd_opts/reserved_fds $SMF_FMRI`
if [ "$reserved_fds" != "" ] ; then
OPTS="$OPTS -r $reserved_fds"
fi
# clear out cmd_opts property group
svccfg <<-EOF
select $SMF_FMRI
delpg cmd_opts
EOF
else
# We are here through enable; use lpsched properties
# Check for saved properties
num_notifiers=`/bin/svcprop -p lpsched/num_notifiers $SERVICE`
if [ "$num_notifiers" != "" ] && [ "$num_notifiers" != "0" ] ; then
OPTS="$OPTS -n $num_notifiers"
fi
num_filters=`/bin/svcprop -p lpsched/num_filters $SERVICE`
if [ "$num_filters" != "" ] && [ "$num_filters" != "0" ] ; then
OPTS="$OPTS -f $num_filters"
fi
fd_limit=`/bin/svcprop -p lpsched/fd_limit $SERVICE`
if [ "$fd_limit" != "" ] && [ "$fd_limit" != "0" ]; then
OPTS="$OPTS -p $fd_limit"
fi
reserved_fds=`/bin/svcprop -p lpsched/reserved_fds $SERVICE`
if [ "$reserved_fds" != "" ] && [ "$reserved_fds" != "0" ] ; then
OPTS="$OPTS -r $reserved_fds"
fi
fi
# set temporary or permanent properties from OPTS
[ -f /usr/lib/lp/local/lpsched ] || exit $SMF_EXIT_ERR_CONFIG
/usr/lib/lp/local/lpsched ${OPTS}
;;
'stop')
[ -f /usr/lib/lp/local/lpshut ] || exit $SMF_EXIT_ERR_CONFIG
/usr/lib/lp/local/lpshut
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit $SMF_EXIT_OK