Home · Latest · Trends  /  general
1

reboot chain

rated 1 times [  1] [ 0]  / comments: 0 / hits: 451  / 10 months ago, wed, feb 22, 2017, 14:57:58
Reboot a group of servers one at a time as each one comes up. Replace the xxx.xxx.xxx.xxx with hostnames or IPs.
!/bin/bash

# Will reboot all servers in array, but one at a time as each comes up...

servers=(
xxx.xxx.xxx.xxx
xxx.xxx.xxx.xxx
)

for server in ${servers[@]}
do
ssh $server sudo shutdown -r now
sleep 120
while ! ping -c1 $server &>/dev/null; do :; done
wait
echo $server complete
date
done
More From » general
 

Comments

There are no comments for this Snippet yet
Only authorized users can post. Please sign in first, or register a free account
 
Share
Sponsor
Posted
rob

rob

Member since Feb 22, 2017
Total Code Snippets: 98
Total Comments: 1
Location: n/a
Following
User not following anyone yet.
rob snippets
10 months ago, wed, feb 22, 2017
10 months ago, wed, feb 22, 2017
10 months ago, wed, feb 22, 2017
10 months ago, wed, feb 22, 2017
10 months ago, wed, feb 22, 2017
10 months ago, wed, feb 22, 2017
10 months ago, wed, feb 22, 2017
10 months ago, wed, feb 22, 2017