How to power on/of the machine by KVM

我买了一个快超微带远程控制的主板。

什么叫远程控制?就是通过网络可以控制主板的开机关机,包括设定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

 

 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值