#!/bin/bash ssh root@machine 'reboot' until ping -c1 machine ; do sleep 1; done ssh root@machine 'reboot'