8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / dispadmin / svc-scheduler
blobb217d51623c247728d05eb356006bd5e4d7f52b3
1 #!/sbin/sh
3 # CDDL HEADER START
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.
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.
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]
21 # CDDL HEADER END
24 # Copyright 2005 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
27 # ident "%Z%%M% %I% %E% SMI"
29 # Set default scheduling class
32 . /lib/svc/share/smf_include.sh
34 [ -f /etc/dispadmin.conf ] || exit $SMF_EXIT_OK
35 if [ -x /usr/sbin/dispadmin ] && [ -x /usr/bin/priocntl ]; then
36 ERROR="$0: cannot set default scheduling class to "
37 DISPADMIN_D=`/usr/sbin/dispadmin -d`
39 if [ $? -eq 0 ]; then
41 # Inform the kernel about the default scheduling class.
43 /usr/sbin/dispadmin -u
45 DEFAULT_SCHEDULER=`echo $DISPADMIN_D | /usr/bin/cut -f1 -d' '`
47 /usr/bin/priocntl -s -c $DEFAULT_SCHEDULER -i all
48 if [ $? -ne 0 ]; then
49 echo $ERROR $DEFAULT_SCHEDULER
50 exit $SMF_EXIT_ERR_FATAL
51 else
53 # Also need to move init process explicitly
54 # because it was ignored by "-i all".
56 /usr/bin/priocntl -s -c $DEFAULT_SCHEDULER -i pid 1
57 if [ $? -ne 0 ]; then
58 echo $ERROR $DEFAULT_SCHEDULER
59 exit $SMF_EXIT_ERR_FATAL
62 else
64 # Default scheduling class from dispadmin.conf is
65 # invalid or not available.
67 exit $SMF_EXIT_ERR_CONFIG
68 fi
69 else
70 # dispadmin or priocntl commands can't be executed
71 echo "$0: cannot execute command"
72 exit $SMF_EXIT_ERR_FATAL
74 exit $SMF_EXIT_OK