summaryrefslogtreecommitdiff
path: root/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-check-host-state.sh
blob: 97f9cfe57a63aedf429e6923fe32b43245c0370a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash

state="xyz.openbmc_project.State.Chassis.PowerState.Off"

dbus-monitor --system type='signal',interface='org.freedesktop.DBus.Properties',\
member='PropertiesChanged',arg0namespace='xyz.openbmc_project.State.Chassis' | \
while read -r line; do
  grep -q member <<< "$line" && continue
  if grep -q $state <<< "$line"; then
    echo "Setting failsafe assuming host is off" >&2
    systemctl start --no-block gbs-host-s5-set-failsafe
  fi
done