Unverified Commit fa20990b authored by Kroese's avatar Kroese Committed by GitHub
Browse files

Update power.sh

parent 3809f7b8
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
#!/usr/bin/env bash
set -Eeuo pipefail

: "${API_TIMEOUT:="50"}"   # API Call timeout
: "${QEMU_TIMEOUT:="50"}"  # QEMU Termination timeout
: "${SHUTDOWN:="Y"}"        # Graceful ACPI shutdown
: "${TIMEOUT:="115"}"       # QEMU termination timeout
: "${API_TIMEOUT:="100"}"   # Single API call timeout

# Configure QEMU for graceful shutdown

API_CMD=6
API_HOST="127.0.0.1:$COM_PORT"

QEMU_END="$QEMU_DIR/qemu.end"
# Configure QEMU for graceful shutdown

if [[ "$KVM" == [Nn]* ]]; then
  API_TIMEOUT=$(( API_TIMEOUT*2 ))
  QEMU_TIMEOUT=$(( QEMU_TIMEOUT*2 ))
fi
QEMU_END="$QEMU_DIR/qemu.end"

_trap() {
  local func="$1"; shift
  local sig
  TRAP_PID=$BASHPID

  for sig; do
    trap "$func $sig" "$sig"
  done
}


finish() {

  local pid