2024-07-15 11:24:23 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
#### About this script
|
|
|
|
|
# Brief : This script is used for outband ac_cyle
|
|
|
|
|
# Input Params : 1.AC cycle times
|
|
|
|
|
# Example : ./outband_dc_cycle.sh 500 100.2.76.100 ADMIN ADMIN&
|
|
|
|
|
# Tips : if want to check anything before machine AC cycle,
|
|
|
|
|
# put code into function pre_check(Line:36)
|
|
|
|
|
|
|
|
|
|
# ----------------------------------------------------
|
|
|
|
|
# Varible Defination
|
|
|
|
|
# ----------------------------------------------------
|
|
|
|
|
aim_cnt=$1
|
|
|
|
|
bmcip=$2
|
|
|
|
|
username=$3
|
|
|
|
|
password=$4
|
|
|
|
|
|
|
|
|
|
PARAM_NUM="4"
|
|
|
|
|
LOG_FILE="outband_ac_cycle.log"
|
|
|
|
|
|
|
|
|
|
# ----------------------------------------------------
|
|
|
|
|
# Function Defination
|
|
|
|
|
# ----------------------------------------------------
|
|
|
|
|
print_usage(){
|
|
|
|
|
echo ">>>> Script Usage - outband_ac_cycle.sh"
|
|
|
|
|
echo "Format: ./outband_ac_cycle.sh [cnt] [BMC ip] [user] [passwd] &"
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-15 16:56:47 +08:00
|
|
|
# is_param_legal(){
|
|
|
|
|
# if [ $# -ne $PARAM_NUM ];then
|
|
|
|
|
# print_usage
|
|
|
|
|
# exit 0
|
|
|
|
|
# fi
|
|
|
|
|
# }
|
2024-07-15 11:24:23 +08:00
|
|
|
|
|
|
|
|
pre_check(){
|
2024-07-26 17:09:35 +08:00
|
|
|
echo "---------------------------------------------"
|
2024-07-15 11:24:23 +08:00
|
|
|
|
|
|
|
|
#Todo if need check something
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
start_ac_cycle(){
|
|
|
|
|
cnt=0
|
|
|
|
|
|
|
|
|
|
while true
|
|
|
|
|
do
|
|
|
|
|
cnt=$(($cnt+1))
|
|
|
|
|
pre_check
|
|
|
|
|
|
2024-07-26 17:09:35 +08:00
|
|
|
echo ">>> start test index $cnt, will perform AC cycle"
|
2024-07-15 11:24:23 +08:00
|
|
|
|
2024-07-26 17:09:35 +08:00
|
|
|
ipmitool -I lanplus -H $bmcip -U $username -P $password raw 0x3c 0x28 0xff 0xfc
|
2024-07-15 11:24:23 +08:00
|
|
|
sleep 10
|
2024-07-26 17:09:35 +08:00
|
|
|
ipmitool -I lanplus -H $bmcip -U $username -P $password raw 0x3c 0x28 0xff 0xfd
|
2024-07-15 11:24:23 +08:00
|
|
|
|
|
|
|
|
if [ $cnt -le $aim_cnt ];then
|
|
|
|
|
sleep 180
|
|
|
|
|
else
|
2024-07-26 17:09:35 +08:00
|
|
|
echo ">>> Complete test , will exit ..."
|
2024-07-15 11:24:23 +08:00
|
|
|
break;
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# ----------------------------------------------------
|
|
|
|
|
# The start of script
|
|
|
|
|
# ----------------------------------------------------
|
2024-07-15 16:56:47 +08:00
|
|
|
if [ $# -ne $PARAM_NUM ];then
|
|
|
|
|
print_usage
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
2024-07-15 11:24:23 +08:00
|
|
|
start_ac_cycle
|