I’ve come across this a couple of times. As a system admin’s day to day tasks, your boss must have at some time given you a long list (let’s say 50+) of servers and all you got to do is getting some system information. Yeah, I know the feeling. It was the boring task when I started as a system admin until scripting twinkled in my mind.
See the below code, does it look familiar ? ``` #!/bin/bash # remoteCmd.sh : The script that runs remote commands
for i in
do ssh $i “uname -a” 2>/dev/null
Save the content in a file as ‘remoteCmd.sh’. Put your server names in a file like ‘serverList’. Give your script execution right.
chmod +x remoteCmd.sh
You can now run the script as follows :