components/ipmitool/svc-ipmievd
branchs11-update
changeset 2526 a7c3342cac79
parent 2525 5e4049097207
child 2527 0935492f14d7
equal deleted inserted replaced
2525:5e4049097207 2526:a7c3342cac79
     1 #!/bin/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 (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
       
    24 #
       
    25 
       
    26 # These are the SMF start/stop/restart methods for ipmievd.
       
    27 
       
    28 # smf(5)
       
    29 . /lib/svc/share/smf_include.sh
       
    30 
       
    31 SMF_FMRI="svc:/network/ipmievd:default"
       
    32 
       
    33 if [ $# -eq 0 ]; then
       
    34     # No arguments provided - report current status (use "-c" option to
       
    35     # svcprop to get the current properties, otherwise false will result)
       
    36     if [ "`/usr/bin/svcprop -c -p general/enabled $SMF_FMRI`" = "true" ]
       
    37     then
       
    38         echo "svc-ipmievd: ipmievd is enabled"
       
    39     else
       
    40         echo "svc-ipmievd: ipmievd is disabled"
       
    41     fi
       
    42 else
       
    43     case "$1" in
       
    44 	'start')
       
    45 		# ipmievd requires the presence of a BMC character device
       
    46 		# to run.  If one is not detected, then disable the service
       
    47 		# and exit.
       
    48 
       
    49 		if [ ! -c /dev/bmc ]; then
       
    50 			echo "$0:  No BMC device found: disabling."
       
    51 			/usr/sbin/svcadm disable $SMF_FMRI
       
    52 			exit $SMF_EXIT_OK
       
    53 		fi
       
    54 
       
    55 		/usr/lib/ipmievd -I bmc sel
       
    56 		[ $? -ne 0 ] && exit 1
       
    57 		;;
       
    58 
       
    59 	*)
       
    60 		echo "Usage: $0 start"
       
    61 		exit 1
       
    62 		;;
       
    63     esac
       
    64 fi
       
    65 
       
    66 exit $SMF_EXIT_OK