blob: b0bbaf6492cbdd4498042fb5f4ebeefb95c416c1 [file] [log] [blame]
Delphine CC Chiu256db822023-06-29 14:57:56 +08001#!/bin/bash
2# Power off the hosts when fan sensors crossed thresholds.
3
4echo "Power off the hosts if fansensors threshold crossed ::"
5
6DBUS_SERVICE="xyz.openbmc_project.State.Chassis"
7DBUS_OBJECT="/xyz/openbmc_project/state/chassis"
8DBUS_INTERFACE="xyz.openbmc_project.State.Chassis"
9DBUS_PROPERTY="RequestedPowerTransition"
10PROPERTY_VALUE="xyz.openbmc_project.State.Chassis.Transition.Off"
11
12# Power off the hosts.
13power-off-all-hosts()
14{
15 for host_id in ${HOST_INSTANCES_SED_REPLACEMENT_VALUE}
16 do
17 echo "chosen host id :::$host_id"
18
19 # host power off
20 output=$(busctl set-property $DBUS_SERVICE"$host_id" $DBUS_OBJECT"$host_id" \
21 $DBUS_INTERFACE $DBUS_PROPERTY s $PROPERTY_VALUE)
22 echo "$output"
23
24 done
25}
26
27power-off-all-hosts