Home | History | Annotate | Download | only in ipmitool
      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 2007 Sun Microsystems, Inc.  All rights reserved.
     24 # Use is subject to license terms.
     25 #
     26 #pragma ident	"@(#)svc-ipmievd	1.1	07/01/11 SMI"
     27 
     28 # These are the SMF start/stop/restart methods for ipmievd.
     29 
     30 # smf(5)
     31 . /lib/svc/share/smf_include.sh
     32 
     33 SMF_FMRI="svc:/network/ipmievd:default"
     34 
     35 if [ $# -eq 0 ]; then
     36     # No arguments provided - report current status (use "-c" option to
     37     # svcprop to get the current properties, otherwise false will result)
     38     if [ "`/usr/bin/svcprop -c -p general/enabled $SMF_FMRI`" = "true" ]
     39     then
     40         echo "svc-ipmievd: ipmievd is enabled"
     41     else
     42         echo "svc-ipmievd: ipmievd is disabled"
     43     fi
     44 else
     45     case "$1" in
     46 	'start')
     47 		# ipmievd requires the presence of a BMC character device
     48 		# to run.  If one is not detected, then disable the service
     49 		# and exit.
     50 
     51 		if [ ! -c /dev/bmc ]; then
     52 			echo "$0:  No BMC device found: disabling."
     53 			/usr/sbin/svcadm disable $SMF_FMRI
     54 			exit $SMF_EXIT_OK
     55 		fi
     56 
     57 		/usr/lib/ipmievd sel
     58 		[ $? -ne 0 ] && exit 1
     59 		;;
     60 
     61 	*)
     62 		echo "Usage: $0 start"
     63 		exit 1
     64 		;;
     65     esac
     66 fi
     67 
     68 exit $SMF_EXIT_OK
     69