#!/usr/bin/env bash set -euo pipefail # Non-destructive helper for command lifecycle canary tests. # Use by starting simclient with: # COMMAND_HELPER_PATH=/home/olafn/infoscreen-dev/scripts/mock-command-helper.sh if [[ $# -ne 1 ]]; then echo "usage: mock-command-helper.sh " >&2 exit 2 fi action="$1" case "$action" in reboot_host|shutdown_host) ;; *) echo "unsupported action: $action" >&2 exit 1 ;; esac if [[ "${MOCK_COMMAND_HELPER_FORCE_FAIL:-0}" == "1" ]]; then echo "forced failure for canary test (action=$action)" >&2 exit 1 fi if [[ "${MOCK_COMMAND_HELPER_SLEEP_SEC:-0}" != "0" ]]; then sleep "${MOCK_COMMAND_HELPER_SLEEP_SEC}" fi echo "mock helper executed action=$action" exit 0