Executing commands on multiple hosts

2015-09-21 116 words 1 min read

If you have to execute the same command in multiple hosts, then you can use mussh:

Description : Mussh is a shell script that allows you to execute a command or script
over ssh on multiple hosts with one command. When possible mussh will use
ssh-agent and RSA/DSA keys to minimize the need to enter your password
more than once.

First install mussh with the following command

dnf install mussh

Now to run this for multiple hosts, you can run like this

mussh -h vm{1..2} -c "hostname"

This will run the commands on hosts – vm1 and vm3
Command that will be run is “hostname”
Similarly you can run other commands as well on multiple machines.


author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it