blob: 3b4d9d9aec854acddc904aaaaec0e2e50d0b0e3b [file] [log] [blame]
Kumar Thangavel29949f42022-07-15 20:33:28 +05301#!/bin/bash
2# Power off the hosts when fan sensors crossed thresholds.
3
4echo "Power off the hosts if fansensors threshold crossed ::"
5
6HOST_INSTANCES="HOST_INSTANCES_SED_REPLACEMENT_VALUE"
7
8DBUS_SERVICE="xyz.openbmc_project.State.Chassis"
9DBUS_OBJECT="/xyz/openbmc_project/state/chassis"
10DBUS_INTERFACE="xyz.openbmc_project.State.Chassis"
11DBUS_PROPERTY="RequestedPowerTransition"
12PROPERTY_VALUE="xyz.openbmc_project.State.Chassis.Transition.Off"
13
14# Power off the hosts.
15power-off-all-hosts()
16{
17 for host_id in $HOST_INSTANCES
18 do
19 echo "chosen host id :::$host_id"
20
21 # host power off
Andrew Geisslerd96085e2023-04-13 15:34:50 -060022 output=$(busctl set-property $DBUS_SERVICE"$host_id" $DBUS_OBJECT"$host_id" $DBUS_INTERFACE $DBUS_PROPERTY s $PROPERTY_VALUE)
Kumar Thangavel29949f42022-07-15 20:33:28 +053023 echo "$output"
24
25 done
26}
27
28power-off-all-hosts