diff --git a/Readme.md b/Readme.md index 552fd8d..09ba6eb 100644 --- a/Readme.md +++ b/Readme.md @@ -2,5 +2,6 @@ ## 脚本列表 - 带内执行power cycle :[inband_dc_cycle.sh](./inband_dc_cycle.sh) +- 带外执行power cycle : [outband_dc_cycle.sh](./outband_dc_cycle.sh) - OS执行reboot :[os_reboot.sh](./os_reboot.sh) - 使用YAFU带内升级BMC :[inband_stress_update.sh](./inband_stress_update.sh) \ No newline at end of file diff --git a/outband_dc_cycle.sh b/outband_dc_cycle.sh new file mode 100644 index 0000000..c40144f --- /dev/null +++ b/outband_dc_cycle.sh @@ -0,0 +1,70 @@ +#!/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 "---------------------------------------------" | tee $LOG_FILE + + #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" | tee $LOG_FILE + + ipmitool -I lanplus -H $bmcip -U $username -P $password power cycle | tee $LOG_FILE + + if [ $cnt -le $aim_cnt ];then + sleep 120 + else + echo ">>> Complete test , will exit ..." | tee $LOG_FILE + break; + fi + + done +} + +# ---------------------------------------------------- +# The start of script +# ---------------------------------------------------- +is_param_legal + +start_dc_cycle \ No newline at end of file