Shell Script to get output from multiple Servers using central Server
If you want to perform ssh from central server to get the information from multiple server using script.
You can use below query -
If you do not want to switch user and only need to fire commands in Linux -
ssh $server_name " your Linux command"
Linux command to switch user and run on multiple server -
ssh $server_name "sudo su - $os_user -c Linux command"
If you want to make a script using above commands and fire on multiple servers , please use as this -
vi script.sh
ssh $server_name " your Linux command"
ssh $server_name " your Linux command"
ssh $server_name " your Linux command"
ssh $server_name " your Linux command"
ssh $server_name " your Linux command"
than close this use wq!
provide permission to script.sh file -
chmod +x script.sh
Now, you can execute file using below command -
./script.sh
Comments
Post a Comment