Run script on many servers


You need the “parallel-ssh” package to execute this script

pip install parallel-ssh

Then, create the script below

# 2017

# Ask for the command to run
echo "What's the commands ? (Syntax : for many commands 'uptime; w; ...;)'"
read command
parallel-ssh --hosts servers --user username -i $command

Now create a file with servers hostnames

Make the script executables

chmod +x

And then run


Finally, specifiy every commands that you want. (For example :”uptime; df -h;”)














Leave a Reply

Your email address will not be published. Required fields are marked *