1#!/bin/bash 2# 3# config: 1234 5 4# @brief: Collect Chassis state information. 5# 6 7. $DREPORT_INCLUDE/functions 8 9services=$(busctl list | awk '{print $1}' | grep -E "xyz.openbmc_project.State.Chassis([0-9]*)?$") 10for service in ${services}; do 11 objpath=$(busctl tree --list $service | tail -n 1) 12 index=$(echo "$service" | grep -o '[0-9]*$') 13 if [ -z "$index" ]; then 14 file_name="chassis-state.log" 15 desc="Chassis State" 16 else 17 file_name="chassis${index}-state.log" 18 desc="Chassis${index} State" 19 fi 20 command="busctl get-property ${service} ${objpath} \ 21 xyz.openbmc_project.State.Chassis CurrentPowerState" 22 add_cmd_output "$command" "$file_name" "$desc" 23done 24