1#!/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 22 output=$(busctl set-property $DBUS_SERVICE"$host_id" $DBUS_OBJECT"$host_id" $DBUS_INTERFACE $DBUS_PROPERTY s $PROPERTY_VALUE) 23 echo "$output" 24 25 done 26} 27 28power-off-all-hosts 29