1#!/bin/bash 2 3BOOT_SERVICE_NAME="xyz.openbmc_project.State.Host" 4BOOT_STATUS_OBJPATH="/xyz/openbmc_project/state/os" 5BOOT_INTERFACE_NAME="xyz.openbmc_project.State.OperatingSystem.Status" 6BOOT_Property="OperatingSystemState" 7 8LED_SERVICE_NAME="xyz.openbmc_project.LED.GroupManager" 9LED_INACTIVE_OBJPATH="/xyz/openbmc_project/led/groups/boot_status_inactive" 10LED_STANDBY_OBJPATH="/xyz/openbmc_project/led/groups/boot_status_standby" 11LED_INTERFACE_NAME="xyz.openbmc_project.Led.Group" 12LED_Property="Asserted" 13 14PWR_STATE_SERVICE="xyz.openbmc_project.State.Chassis" 15PWR_STATE_OBJPATH="/xyz/openbmc_project/state/chassis0" 16PWR_STATE_INTERFACE_NAME="xyz.openbmc_project.State.Chassis" 17PWR_STATE_Property="CurrentPowerState" 18 19boot_status="" 20power_state="" 21led_status="" 22 23mapper wait $LED_INACTIVE_OBJPATH 24mapper wait $LED_STANDBY_OBJPATH 25while true; do 26 power_state="$(busctl get-property $PWR_STATE_SERVICE $PWR_STATE_OBJPATH $PWR_STATE_INTERFACE_NAME $PWR_STATE_Property | awk '{print $2}')" 27 28 boot_status="$(busctl get-property $BOOT_SERVICE_NAME $BOOT_STATUS_OBJPATH $BOOT_INTERFACE_NAME $BOOT_Property | awk '{print $2}')" 29 30 if [[ $power_state != "\"xyz.openbmc_project.State.Chassis.PowerState.On\"" ]];then 31 if [[ $led_status != "OFF" ]];then 32 busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b false 33 busctl set-property $LED_SERVICE_NAME $LED_STANDBY_OBJPATH $LED_INTERFACE_NAME $LED_Property b false 34 led_status="OFF" 35 fi 36 continue 37 else 38 if [[ $boot_status != "\"xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Standby\"" ]] && [[ $led_status != "BLINKING" ]];then 39 busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b true 40 led_status="BLINKING" 41 elif [[ $boot_status == "\"xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Standby\"" ]] && [[ $led_status != "ON" ]];then 42 busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b false 43 busctl set-property $LED_SERVICE_NAME $LED_STANDBY_OBJPATH $LED_INTERFACE_NAME $LED_Property b true 44 led_status="ON" 45 fi 46 fi 47 sleep 1 48done 49 50exit 0 51