Home · Latest · Trends  /  general
0

Use SSH in batch mode if hitting multiple servers

rated 0 times [  0] [ 0]  / comments: 0 / hits: 166  / 10 months ago, thu, mar 1, 2018, 15:08:49
Using batch mode and adding a timeout will help get through a long list of servers that may or may not be up.
# SSH as user root to multiple rowty.net servers..

# The list of servers
host1.rowty.net
host2.rowty.net
host3.rowty.net

# Run a command on all of them - using batchmode and timeout
for m in $(cat ./rowty-servers.txt);do ssh -o BatchMode=yes -o ConnectTimeout=1 root@rowty.net "uptime";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: 118
Total Comments: 1
Location: n/a
Following
User not following anyone yet.
rob snippets
2 yaers ago, wed, feb 22, 2017
2 yaers ago, wed, feb 22, 2017
2 yaers ago, wed, feb 22, 2017
2 yaers ago, wed, feb 22, 2017
2 yaers ago, wed, feb 22, 2017
2 yaers ago, wed, feb 22, 2017
2 yaers ago, wed, feb 22, 2017
2 yaers ago, wed, feb 22, 2017