blob: 782f0853140394a884eced0315231d47d29e0abb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/bin/bash
# Power off the hosts when fan sensors crossed thresholds.
echo "Power off the hosts if fansensors threshold crossed ::"
HOST_INSTANCES="HOST_INSTANCES_SED_REPLACEMENT_VALUE"
DBUS_SERVICE="xyz.openbmc_project.State.Chassis"
DBUS_OBJECT="/xyz/openbmc_project/state/chassis"
DBUS_INTERFACE="xyz.openbmc_project.State.Chassis"
DBUS_PROPERTY="RequestedPowerTransition"
PROPERTY_VALUE="xyz.openbmc_project.State.Chassis.Transition.Off"
# Power off the hosts.
power-off-all-hosts()
{
for host_id in $HOST_INSTANCES
do
echo "chosen host id :::$host_id"
# host power off
output=$(busctl set-property $DBUS_SERVICE$host_id $DBUS_OBJECT$host_id $DBUS_INTERFACE $DBUS_PROPERTY s $PROPERTY_VALUE)
echo "$output"
done
}
power-off-all-hosts
|