#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
echo "$NAME: Checking SSH connection ($i/$SSH_CHECKS) ..."
ssh -q "$SYSTEM" true >/dev/null 2>&1 && break
echo "$NAME: SSH on \"$SYSTEM\" not ready. Waiting ..."
echo "$NAME: Checking SSH connection ($i/$SSH_CHECKS) ..."
ssh -q "$SYSTEM" true >/dev/null 2>&1 && break
echo "$NAME: SSH on \"$SYSTEM\" not ready. Waiting ..."
ssh -q "$SYSTEM" "sync; shutdown -hP $SHUTDOWN_TIME" >/dev/null
if [ $? -ne 0 ]; then
echo "$NAME: Failed to power off \"$SYSTEM\"!" >&2
ssh -q "$SYSTEM" "sync; shutdown -hP $SHUTDOWN_TIME" >/dev/null
if [ $? -ne 0 ]; then
echo "$NAME: Failed to power off \"$SYSTEM\"!" >&2