@@ -1,8 +1,8 @@
#!/bin/bash
# Inventory System
# Author: Carsten Schoene
-# $LastChangedDate: 2012-07-21 10:36:52 +0200 (Sat, 21 Jul 2012) $
-# $Rev: 1622 $
+# $LastChangedDate: 2012-07-21 11:27:04 +0200 (Sat, 21 Jul 2012) $
+# $Rev: 1623 $
#
# Default options (can be changed by inventory-system.conf)
DEBUG="yes"
@@ -257,14 +257,18 @@
# get ipmi mac
function get_system_mgmt_mac {
- ${MODPROBE} ipmi_devintf 2>/dev/null
- ${MODPROBE} ipmi_si 2>/dev/null
- ${IPMITOOL} lan print 1 2>&1 >/dev/null
+ ${MODPROBE} ipmi_devintf 2&>1 >/dev/null
+ ${MODPROBE} ipmi_si 2&>1 >/dev/null
if [ $? == 0 ] ; then
- MAC=`${IPMITOOL} lan print 1 | ${GREP} -E '(^MAC Address)' | ${AWK} '{print tolower($NF)}' | \
- ${GREP} -i -E '([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})'`
- fi
- if [ -z "${MAC}" ] ; then
+ ${IPMITOOL} lan print 2&>1 >/dev/null
+ if [ $? == 0 ] ; then
+ MAC=`${IPMITOOL} lan print 1 | ${GREP} -E '(^MAC Address)' | ${AWK} '{print tolower($NF)}' | \
+ ${GREP} -i -E '([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})'`
+ fi
+ if [ -z "${MAC}" ] ; then
+ MAC="none"
+ fi
+ else
MAC="none"
fi
debug "SYSTEM-MGMT-MAC: ${MAC}"
@@ -273,13 +277,17 @@
# get ipmi ip
function get_system_mgmt_ip {
- ${MODPROBE} ipmi_devintf 2>/dev/null
- ${MODPROBE} ipmi_si 2>/dev/null
- ${IPMITOOL} lan print 1 2>&1 >/dev/null
+ ${MODPROBE} ipmi_devintf 2&>1 >/dev/null
+ ${MODPROBE} ipmi_si 2&>1 >/dev/null
if [ $? == 0 ] ; then
- MGMTIP=`${IPMITOOL} lan print 1 | ${GREP} -E '(^IP Address) ' | ${AWK} '{print $NF}'`
- fi
- if [ -z "${MGMTIP}" ] ; then
+ ${IPMITOOL} lan print 1 2&>1 >/dev/null
+ if [ $? == 0 ] ; then
+ MGMTIP=`${IPMITOOL} lan print 1 | ${GREP} -E '(^IP Address) ' | ${AWK} '{print $NF}'`
+ fi
+ if [ -z "${MGMTIP}" ] ; then
+ MGMTIP="none"
+ fi
+ else
MGMTIP="none"
fi
debug "SYSTEM-MGMT-IP: ${MGMTIP}"
|