Add ( script : inband_stress_update.sh)
This commit is contained in:
parent
c4e5fad891
commit
7871870af6
@ -2,4 +2,5 @@
|
||||
|
||||
## 脚本列表
|
||||
- 带内执行power cycle :[inband_dc_cycle.sh](./inband_dc_cycle.sh)
|
||||
- OS执行reboot :[os_reboot.sh](./os_reboot.sh)
|
||||
- OS执行reboot :[os_reboot.sh](./os_reboot.sh)
|
||||
- 使用YAFU带内升级BMC :[inband_stress_update.sh](./inband_stress_update.sh)
|
||||
84
inband_stress_update.sh
Normal file
84
inband_stress_update.sh
Normal file
@ -0,0 +1,84 @@
|
||||
#!/bin/bash
|
||||
|
||||
#### About this script
|
||||
# Brief : This script is used for inband bmc update by yafuflash
|
||||
# Input Params : 1.update times
|
||||
# Example : ./inband_stress_update 200 ./image1 ./image2 &
|
||||
# Tips : if want to check anything before stress update,
|
||||
# put code into function pre_check(Line:37)
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Varible Defination
|
||||
# ----------------------------------------------------
|
||||
aim_cnt=$1
|
||||
image1=$2
|
||||
image2=$3
|
||||
|
||||
PARAM_NUM="3"
|
||||
YAFU="./Yafuflash"
|
||||
LOG_FILE="./inband_stress_update.log"
|
||||
sleep_time=600
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Function Defination
|
||||
# ----------------------------------------------------
|
||||
print_usage(){
|
||||
echo ">>> Script Usage - inband_stress_update.sh"
|
||||
echo "Format : ./inband_stress_update.sh [cnt] [image1] [image2]"
|
||||
}
|
||||
|
||||
is_param_legal(){
|
||||
if [ $# -ne $PARAM_NUM ];then
|
||||
print_usage
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
pre_check(){
|
||||
# check if local cnt file exist
|
||||
echo "---------------------------------------------" | tee $LOG_FILE
|
||||
|
||||
#Todo if need check something
|
||||
ipmitool mc info | tee $LOG_FILE
|
||||
if [ $? -ne 0 ];then
|
||||
echo ">>> BMC Die, script terminated ..." | tee $LOG_FILE
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
start_stress_update(){
|
||||
cnt=0
|
||||
use_image=$image2
|
||||
while true
|
||||
do
|
||||
cnt=$(($cnt+1))
|
||||
echo ">>> start test index $cnt" | tee $LOG_FILE
|
||||
|
||||
pre_check
|
||||
|
||||
# select image to use
|
||||
if [ "$use_image" == "$image1" ];then
|
||||
use_image=$image2
|
||||
else
|
||||
use_image=$image1
|
||||
fi
|
||||
echo ">>> Use Image : $use_image" | tee $LOG_FILE
|
||||
|
||||
# start update
|
||||
$YAFU -cd $use_image -pc | tee $LOG_FILE
|
||||
echo ">>> End of update , start sleep 600s ..." | tee $LOG_FILE
|
||||
|
||||
if [ $cnt -le $aim_cnt ];then
|
||||
sleep $sleep_time
|
||||
else
|
||||
echo ">>> Complete stress update, Exit ..." | tee $LOG_FILE
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# ----------------------------------------------------
|
||||
# The start of script
|
||||
# ----------------------------------------------------
|
||||
is_param_legal
|
||||
|
||||
start_stress_update
|
||||
Loading…
Reference in New Issue
Block a user