work_sript/01.stress_script/outband_dc_cycle.sh
2024-07-26 17:09:35 +08:00

73 lines
1.6 KiB
Bash

#!/bin/bash
#### About this script
# Brief : This script is used for outband dc_cyle
# Input Params : 1.DC cycle times
# Example : ./inband_dc_cycle.sh 500 100.2.76.100 ADMIN ADMIN&
# Tips : if want to check anything before cpu power 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_dc_cycle.log"
# ----------------------------------------------------
# Function Defination
# ----------------------------------------------------
print_usage(){
echo ">>>> Script Usage - outband_dc_cycle.sh"
echo "Format: ./outband_dc_cycle.sh [cnt] [BMC ip] [user] [passwd] &"
}
# is_param_legal(){
# if [ $# -ne $PARAM_NUM ];then
# print_usage
# exit 0
# fi
# }
pre_check(){
echo "---------------------------------------------"
#Todo if need check something
}
start_dc_cycle(){
cnt=0
while true
do
cnt=$(($cnt+1))
pre_check
echo ">>> start test index $cnt, will perform power cycle"
ipmitool -I lanplus -H $bmcip -U $username -P $password power cycle
if [ $cnt -le $aim_cnt ];then
sleep 120
else
echo ">>> Complete test , will exit ..."
break;
fi
done
}
# ----------------------------------------------------
# The start of script
# ----------------------------------------------------
if [ $# -ne $PARAM_NUM ];then
print_usage
exit 0
fi
start_dc_cycle