On Tue, Oct 20, 2020 at 02:31:51PM +0800, Zhang Yu wrote:
On Tue, Oct 20, 2020 at 11:55:26AM +0800, Sun Yukui wrote:
On Tue, Oct 20, 2020 at 11:10:09AM +0800, Zhang Yu wrote:
+get_ipmi_ip() +{
- # ipmitool lan print
- # Set in Progress : Set Complete
- # IP Address Source : Static Address
- # IP Address : 9.3.4.1
- # Subnet Mask : 255.255.0.0
- # MAC Address : e0:00:84:2b:51:7b
- # SNMP Community String : TrapAdmin12#$
- # IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
- # Default Gateway IP : 9.3.0.1
- # 802.1q VLAN ID : Disabled
- # RMCP+ Cipher Suites : 0,1,2,3,17
- # Cipher Suite Priv Max : XuuaXXXXXXXXXXX
- imp_ip=$(ipmitool lan print |awk 'NR==3{print $4}')
- [ $? -eq 0 ] && echo "ipmi_ip:" $imp_ip
[ -n "$imp_ip" ] && echo $imp_ip
Thanks sunyukui
1: line 4: ipmitool: command not found ipmi_ip: 这是错误信息,可以验证imp_ip是否为空,让程序更健壮
Look good, could you show me a example? Thanks, Zhangyu
Thanks sunyukui
+}
main() { get_node @@ -87,6 +105,7 @@ main() get_partitions get_mac get_model_name
- get_ipmi_ip
}
main
2.23.0