Commit ddbc4a65 authored by Terence Chuen's avatar Terence Chuen
Browse files

BUG修复

1. 修正T620 IPMI脚本在服务器重启后无法立即降低转速的问题。
parent 2af69d9f
......@@ -46,9 +46,30 @@ else
speed_range=1
fi
# 转速进制转换
speed_hex="0x"$(echo "obase=16; $(echo $fan_speed | cut -d ',' -f $speed_range)" | bc)
inlet_temp=$((inlet_temp / 10))
fan_speed=$(echo $fan_speed | cut -d ',' -f $speed_range)%
inlet_temp=$((inlet_temp / 10))
# 判断系统是否重启
sys_boot_time=$(who -b | sed s/[[:space:]]//g)
if [ -f .t620_ipmi_fan_speed_controller.tmp ]; then
if [ "$(cat .t620_ipmi_fan_speed_controller.tmp)" != "$sys_boot_time" ]; then
ipmitool -I lanplus -H $ipmi_host -U $ipmi_user -P $ipmi_passwd raw 0x30 0x30 0x01 0x00
ipmitool -I lanplus -H $ipmi_host -U $ipmi_user -P $ipmi_passwd raw 0x30 0x30 0x02 0xff "$speed_hex"
echo "$(date '+%Y-%m-%d %H:%M:%S') cpu_temp=$calc_avg_temp inlet_temp=$inlet_temp \
fan_speed_range=$speed_range fan_speed=$fan_speed msg=\"System reboot, Cooling fan reduces speed\"" >> $log_path
echo $sys_boot_time > .t620_ipmi_fan_speed_controller.tmp
exit 0
fi
else
ipmitool -I lanplus -H $ipmi_host -U $ipmi_user -P $ipmi_passwd raw 0x30 0x30 0x01 0x00
ipmitool -I lanplus -H $ipmi_host -U $ipmi_user -P $ipmi_passwd raw 0x30 0x30 0x02 0xff "$speed_hex"
echo "$(date '+%Y-%m-%d %H:%M:%S') cpu_temp=$calc_avg_temp inlet_temp=$inlet_temp \
fan_speed_range=$speed_range fan_speed=$fan_speed msg=\"System reboot, Cooling fan reduces speed\"" >> $log_path
echo $sys_boot_time > .t620_ipmi_fan_speed_controller.tmp
exit 0
fi
# 判断日志文件是否存在
if [ -f $log_path ]; then
......@@ -57,7 +78,7 @@ if [ -f $log_path ]; then
# 若目标区间值大于最后一条日志中的区间值,则立即上调转速,然后写入日志并退出程序
if [ "$speed_range" -gt "$fan_speed_now" ]; then
ipmitool -I lanplus -H $ipmi_host -U $ipmi_user -P $ipmi_passwd raw 0x30 0x30 0x01 0x00
ipmitool -I lanplus -H $ipmi_host -U $ipmi_user -P $ipmi_passwd raw 0x30 0x30 0x01 0x00
ipmitool -I lanplus -H $ipmi_host -U $ipmi_user -P $ipmi_passwd raw 0x30 0x30 0x02 0xff "$speed_hex"
echo "$(date '+%Y-%m-%d %H:%M:%S') cpu_temp=$calc_avg_temp inlet_temp=$inlet_temp \
fan_speed_range=$speed_range fan_speed=$fan_speed msg=\"Cooling fan increases speed\"" >> $log_path
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment