如何远程通过ipmitool关闭服务器电源?(ipmitool power off、on、soft、reset)

背景

关闭服务器有几种方式:halt、手动长按服务器开关、ipmitool。
使用halt命令,有些时候未知原因还会重启。如何通过ipmitool能够远程关闭主机?

命令

ipmitool power off

实操

在这里插入图片描述

其他

以上命令是本机登录后关闭本机的。如果BMC通畅,可以通过ipmitool工具远程关闭指定的服务器。因为ipmitool 工具通过 IPMI 协议发送命令来控制服务器的电源状态,包括冷关机。冷关机通常是指直接切断电源,而不是通过操作系统来执行关机流程。
具体命令:

ipmitool -I lanplus -H <BMC_IP> -U <USERNAME> -
root@prigz-k8s-bgp-yiduncpuyw12:~# ipmitool sel elist 1 | 01/10/2025 | 03:41:57 | Event Logging Disabled Event_log | Log area reset/cleared | Asserted 2 | 02/21/2025 | 15:37:13 | System ACPI Power State ACPI_state | S5/G2: soft-off | Asserted 3 | 02/21/2025 | 15:42:33 | System ACPI Power State ACPI_state | S5/G2: soft-off | Asserted 4 | 02/21/2025 | 15:42:33 | Processor CPU0_Status | Presence detected | Asserted 5 | 02/21/2025 | 15:42:33 | Processor CPU1_Status | Presence detected | Asserted 6 | 02/21/2025 | 15:42:34 | Power Supply PSU1_Status | Presence detected | Asserted 7 | 02/21/2025 | 15:42:34 | Power Supply PSU2_Status | Presence detected | Asserted 8 | 02/21/2025 | 15:42:34 | Microcontroller BMC_Start | Device Enabled | Asserted 9 | 02/21/2025 | 15:43:28 | Button Power_Button | Power Button pressed | Asserted a | 02/21/2025 | 15:43:29 | System ACPI Power State ACPI_state | S0/G0: working | Asserted b | 02/21/2025 | 15:43:59 | Add-in Card OCP_Card1_Sta | Device Absent | Asserted c | 02/21/2025 | 15:43:59 | Add-in Card OCP_Card2_Sta | Device Absent | Asserted d | 02/21/2025 | 15:44:24 | System Event #0xf7 | Timestamp Clock Sync | Asserted e | 02/21/2025 | 15:44:30 | Memory DIMM2 | Presence Detected | Asserted f | 02/21/2025 | 15:44:30 | Memory DIMM6 | Presence Detected | Asserted 10 | 02/21/2025 | 15:44:30 | Memory DIMM9 | Presence Detected | Asserted 11 | 02/21/2025 | 15:44:30 | Memory DIMM13 | Presence Detected | Asserted 12 | 02/21/2025 | 15:44:30 | Memory DIMM18 | Presence Detected | Asserted 13 | 02/21/2025 | 15:44:30 | Memory DIMM22 | Presence Detected | Asserted 14 | 02/21/2025 | 15:44:30 | Memory DIMM25 | Presence Detected | Asserted 15 | 02/21/2025 | 15:44:30 | Memory DIMM29 | Presence Detected | Asserted 16 | 02/21/2025 | 15:44:32 | Drive Slot / Bay Disk0 | Drive Present | Asserted 17 | 02/21/2025 | 15:46:26 | System ACPI Power State ACPI_state | S5/G2: soft-off | Asserted 18 | 02/21/2025 | 15:46:31 | System ACPI Power State ACPI_state | S0/G0: working | Asserted 19 | 02/21/2025 | 15:47:10 | System Boot Initiated RestartInitiated | Initiated by warm reset | Asserted 1a | 02/21/2025 | 15:49:14 | System Event #0xf7 | Timestamp Clock Sync | Asserted 1b | 02/21/2025 | 15:51:40 | OS Boot | boot completed - device not specified | Asserted root@prigz-k8s-bgp-yiduncpuyw12:~#
03-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值