#!/bin/bash -l # Copyright (C) 2016 Ian Kelling # This program is under GPL v. 3 or later, see # distro setup full. (assuming we already synced data files to the host) set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR host=$1 if [[ ! $host || $host == -h ]]; then echo "$0: error: expected 1 arg of hostname" exit 1 fi set -x ssh $host sudo bash <<'EOF' set -e systemctl stop keyscriptoff.service reboot ||: EOF pxe-server fai $host while ! ssh $host :; do sleep 5 done dsremote $host