components/ipmitool/svc-ipmievd
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 11 Mar 2013 10:38:09 -0700
branchs11-update
changeset 2520 ceec631e74d1
parent 2328 088dd9a36556
permissions -rw-r--r--
Close of build 10.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
268
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     1
#!/bin/sh
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     2
#
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     3
# CDDL HEADER START
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     4
#
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     8
#
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    12
# and limitations under the License.
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    13
#
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    19
#
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    20
# CDDL HEADER END
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    21
#
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    22
#
2328
088dd9a36556 7184529 ipmievd daemon not run when open driver is not available
henryzh <henry.zhao@oracle.com>
parents: 268
diff changeset
    23
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
268
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    24
#
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    25
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    26
# These are the SMF start/stop/restart methods for ipmievd.
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    27
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    28
# smf(5)
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    29
. /lib/svc/share/smf_include.sh
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    30
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    31
SMF_FMRI="svc:/network/ipmievd:default"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    32
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    33
if [ $# -eq 0 ]; then
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    34
    # No arguments provided - report current status (use "-c" option to
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    35
    # svcprop to get the current properties, otherwise false will result)
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    36
    if [ "`/usr/bin/svcprop -c -p general/enabled $SMF_FMRI`" = "true" ]
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    37
    then
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    38
        echo "svc-ipmievd: ipmievd is enabled"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    39
    else
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    40
        echo "svc-ipmievd: ipmievd is disabled"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    41
    fi
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    42
else
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    43
    case "$1" in
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    44
	'start')
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    45
		# ipmievd requires the presence of a BMC character device
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    46
		# to run.  If one is not detected, then disable the service
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    47
		# and exit.
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    48
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    49
		if [ ! -c /dev/bmc ]; then
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    50
			echo "$0:  No BMC device found: disabling."
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    51
			/usr/sbin/svcadm disable $SMF_FMRI
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    52
			exit $SMF_EXIT_OK
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    53
		fi
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    54
2328
088dd9a36556 7184529 ipmievd daemon not run when open driver is not available
henryzh <henry.zhao@oracle.com>
parents: 268
diff changeset
    55
		/usr/lib/ipmievd -I bmc sel
268
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    56
		[ $? -ne 0 ] && exit 1
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    57
		;;
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    58
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    59
	*)
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    60
		echo "Usage: $0 start"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    61
		exit 1
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    62
		;;
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    63
    esac
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    64
fi
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    65
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    66
exit $SMF_EXIT_OK