在为arm服务器安装系统的时候,需要通过BMC进入到arm节点的uboot控制台执行刷机命令,操作步骤比较繁琐,所以自己写了个简单的脚本,直接输入节点的编号就能自动进入该节点uboot控制台了,很方便。

使用方法:复制以下代码保存到start.bat文件中,然后复制到ipmitool.exe工具目录下面,双击start.bat就可以了。

通过BMC自动进入arm服务器节点控制台脚本-编程知识网

 附上ipmitool工具的下载地址:ipmitool下载地址

@echo off
##设置当前cmd命令行窗口编码为UTF-8,以免出现中文乱码
CHCP 65001
:start
cls
echo             arm服务器系统安装 for xiang
echo --------------------------------------------- 
set/p a=输入需要安装的服务器节点序号(1-12):
if %a%==1 goto arm1
if %a%==2 goto arm2
if %a%==3 goto arm3
if %a%==4 goto arm4
if %a%==5 goto arm5
if %a%==6 goto arm6
if %a%==7 goto arm7
if %a%==8 goto arm8
if %a%==9 goto arm9
if %a%==10 goto arm10
if %a%==11 goto arm11
if %a%==12 goto arm12
if %a% GTR 12 goto start
if %a% LSS 1 goto start

:arm1
echo 进入arm1节点的uboot界面......
start "解除当前连接" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol deactivate
start "连接序列号为1的arm服务器" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser raw 0x00  0x10 1
start "准备进入arm1服务器uboot界面,当出现Hit any key to stop autoboot:  3时按下空格或回车键" "cmd /k TIMEOUT /T 10&&ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol activate"
start "连接序列号为1的arm服务器" "cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x30 1"
start "准备重启当前连接的节点" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x31 3
goto start

:arm2
echo 进入arm2节点的uboot界面......
start "解除当前连接" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol deactivate
start "连接序列号为1的arm服务器" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser raw 0x00  0x10 2
start "准备进入arm2服务器uboot界面,当出现Hit any key to stop autoboot:  3时按下空格或回车键" "cmd /k TIMEOUT /T 10&&ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol activate"
start "连接序列号为1的arm服务器" "cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x30 2"
start "准备重启当前连接的节点" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x31 3
goto start

:arm3
echo 进入arm3节点的uboot界面......
start "解除当前连接" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol deactivate
start "连接序列号为1的arm服务器" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser raw 0x00  0x10 3
start "准备进入arm3服务器uboot界面,当出现Hit any key to stop autoboot:  3时按下空格或回车键" "cmd /k TIMEOUT /T 10&&ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol activate"
start "连接序列号为1的arm服务器" "cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x30 3"
start "准备重启当前连接的节点" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x31 3
goto start

:arm4
echo 进入arm4节点的uboot界面......
start "解除当前连接" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol deactivate
start "连接序列号为1的arm服务器" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser raw 0x00  0x10 4
start "准备进入arm4服务器uboot界面,当出现Hit any key to stop autoboot:  3时按下空格或回车键" "cmd /k TIMEOUT /T 10&&ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol activate"
start "连接序列号为1的arm服务器" "cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x30 4"
start "准备重启当前连接的节点" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x31 3
goto start

:arm5
echo 进入arm5节点的uboot界面......
start "解除当前连接" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol deactivate
start "连接序列号为1的arm服务器" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser raw 0x00  0x10 5
start "准备进入arm5服务器uboot界面,当出现Hit any key to stop autoboot:  3时按下空格或回车键" "cmd /k TIMEOUT /T 10&&ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol activate"
start "连接序列号为1的arm服务器" "cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x30 5"
start "准备重启当前连接的节点" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x31 3
goto start

:arm6 
echo 进入arm6节点的uboot界面......
start "解除当前连接" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol deactivate
start "连接序列号为1的arm服务器" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser raw 0x00  0x10 6
start "准备进入arm6服务器uboot界面,当出现Hit any key to stop autoboot:  3时按下空格或回车键" "cmd /k TIMEOUT /T 10&&ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol activate"
start "连接序列号为1的arm服务器" "cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x30 6"
start "准备重启当前连接的节点" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x31 3
goto start

:arm7 
echo 进入arm7节点的uboot界面......
start "解除当前连接" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol deactivate
start "连接序列号为1的arm服务器" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser raw 0x00  0x10 7
start "准备进入arm7服务器uboot界面,当出现Hit any key to stop autoboot:  3时按下空格或回车键" "cmd /k TIMEOUT /T 10&&ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol activate"
start "连接序列号为1的arm服务器" "cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x30 7"
start "准备重启当前连接的节点" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x31 3
goto start

:arm8
echo 进入arm8节点的uboot界面......
start "解除当前连接" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol deactivate
start "连接序列号为1的arm服务器" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser raw 0x00  0x10 8
start "准备进入arm8服务器uboot界面,当出现Hit any key to stop autoboot:  3时按下空格或回车键" "cmd /k TIMEOUT /T 10&&ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol activate"
start "连接序列号为1的arm服务器" "cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x30 8"
start "准备重启当前连接的节点" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x31 3
goto start

:arm9
echo 进入arm9节点的uboot界面......
start "解除当前连接" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol deactivate
start "连接序列号为1的arm服务器" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser raw 0x00  0x10 9
start "准备进入arm9服务器uboot界面,当出现Hit any key to stop autoboot:  3时按下空格或回车键" "cmd /k TIMEOUT /T 10&&ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol activate"
start "连接序列号为1的arm服务器" "cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x30 9"
start "准备重启当前连接的节点" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x31 3
goto start

:arm10
echo 进入arm10节点的uboot界面......
start "解除当前连接" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol deactivate
start "连接序列号为1的arm服务器" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser raw 0x00  0x10 10
start "准备进入arm10服务器uboot界面,当出现Hit any key to stop autoboot:  3时按下空格或回车键" "cmd /k TIMEOUT /T 10&&ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol activate"
start "连接序列号为1的arm服务器" "cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x30 10"
start "准备重启当前连接的节点" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x31 3
goto start

:arm11
echo 进入arm11节点的uboot界面......
start "解除当前连接" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol deactivate
start "连接序列号为1的arm服务器" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser raw 0x00  0x10 11
start "准备进入arm11服务器uboot界面,当出现Hit any key to stop autoboot:  3时按下空格或回车键" "cmd /k TIMEOUT /T 10&&ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol activate"
start "连接序列号为1的arm服务器" "cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x30 11"
start "准备重启当前连接的节点" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x31 3
goto start

:arm12
echo 进入arm12节点的uboot界面......
start "解除当前连接" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol deactivate
start "连接序列号为1的arm服务器" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser raw 0x00  0x10 12
start "准备进入arm12服务器uboot界面,当出现Hit any key to stop autoboot:  3时按下空格或回车键" "cmd /k TIMEOUT /T 10&&ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser sol activate"
start "连接序列号为1的arm服务器" "cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x30 12"
start "准备重启当前连接的节点" cmd /c ipmitool -I lanplus -H  192.168.1.18 -U root -P superuser i2c 0x2c 0 0x31 3
goto start
pause

脚本窗口截图:

通过BMC自动进入arm服务器节点控制台脚本-编程知识网