我买了一个快超微带远程控制的主板。
什么叫远程控制?就是通过网络可以控制主板的开机关机,包括设定BIOS。在远程通过java客户端来控制主板,就跟用显示器一下,只是显示器变成了一个java窗口。
有时候通过另外一台linux,没有浏览器,怎么去控制主板的开关机呢?
W3M:
1、yum install W3M
2、w3m 192.168.1.x
3、input the user/passwd -- after that, the w3m have received the session id from server side.
4、input 'U'
5、select the property URL in the bottom, and change it to /cgi/ipmi.cgi?POWER_INFO.XML=(1,1) -- (1,1) power on; (1,3) power off; (1,5) reset
请参照下面的图片
CURL:
创建这样一个shell脚本:
#!/bin/bash
action=up
action_flag=1
host=192.168.1.119
if [ $1 ]
then
if [ "$1" = "down" ]; then
action_flag=3
action=down
elsif [ "$1" = "reset" ]
action_flag=5
action=reset
fi
fi
if [ $2 ]
then
host = $2
fi
echo "This command will $action the machine $host, please waiting..."
sid=$(curl -i --data "name=ADMIN&pwd=ADMIN" "$host/cgi/login.cgi" | grep Set-Cookie | grep path | cut -d '=' -f 2 | cut -d ';' -f 1)
curl --cookie "langSetFlag=0;SID=$sid" "$host/cgi/ipmi.cgi?POWER_INFO.XML=(1,$action_flag)"
echo "\n"
echo "operation ($host/cgi/ipmi.cgi?POWER_INFO.XML=(1,$action_flag)) has been sent."
使用方法是: super_ipmi.sh [action] [host]
action: up -> power on; down -> power down; reset -> reset
host: 主机的名称或者IP Address
例子: super_ipmi.sh up 192.168.1.119