29 lines
795 B
Bash
29 lines
795 B
Bash
#!/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
|