Wait for linux machine to be rebooted
Posted
by
Theo
on Super User
See other posts from Super User
or by Theo
Published on 2013-10-28T09:07:01Z
Indexed on
2013/10/28
9:56 UTC
Read the original article
Hit count: 136
I have a small script to install on my remote machine an update.
I would like to reboot the machine remotely and if it is rebooted, continue with some more commands. What I currently do is:
ssh root@myMachine << COMMANDS_ISSUED
###... Tasks
init 6
COMMANDS_ISSUED
sleep 180s
ssh root@myMachine << POST_REBOOT_COMMANDS
###.... More stuff
POST_REBOOT_COMMANDS
Is there a more elegant way to do it? Like pinging the machine all 5 seconds up to a maximum of 4 minutes? I play with a few linux machines which have different boot up times and if my script would continue immediately after reboot, this could safe quite some time for me. (Note: I don't want to parallelize execution over all machines as I want to see for each machine if everything worked fine)
© Super User or respective owner