summaryrefslogtreecommitdiff
path: root/meta-facebook/meta-yosemite4/recipes-phosphor/state/phosphor-state-manager/host-powercycle
blob: 395835429329dbbf1a419a6bf052355af3874260 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

# shellcheck disable=SC2120

# Provide source directive to shellcheck.
# shellcheck source=meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/power-cmd
source /usr/libexec/phosphor-state-manager/power-cmd

# TODO: check power status before do power cycle
# Set state effecter state: Entity ID 0x0000 for host power control, 0x3 for power cycle
EID=$(($1*10))
if ! pldmtool raw -d 0x80 0x02 0x39 0x00 0x00 0x01 0x00 0x03 -m "$EID"
then
    echo "Failed to set host$1 power cycle"
else
    echo "Host is power cycle"
fi