#!/usr/bin/env bash set -euo pipefail # Privileged command helper for remote reboot/shutdown actions. # Intended installation path: /usr/local/bin/infoscreen-cmd-helper.sh # Suggested sudoers entry: # infoscreen ALL=(ALL) NOPASSWD: /usr/local/bin/infoscreen-cmd-helper.sh if [[ $# -ne 1 ]]; then echo "usage: infoscreen-cmd-helper.sh " >&2 exit 2 fi action="$1" case "$action" in reboot_host) exec systemctl reboot ;; shutdown_host) exec systemctl poweroff ;; *) echo "unsupported action: $action" >&2 exit 1 ;; esac