set -x
if $reboot; then
- ssh $host sudo bash <<'EOF' || [[ $? == 255 ]]
-touch /tmp/keyscript-off
-reboot ||:
-EOF
+ # untested, this caused hang using here doc.
+ ssh $host sudo bash -c "touch /tmp/keyscript-off; reboot" ||:
fi
pxe-server fai $host