I frequently run some commands/scripts on a batch of servers whose IPs are already collected in a file. I usually use a simple loop and call the
ssh to run these commands remotely and automatically. This operation, however, is common and can be abstracted into a separate script.
Here is the script that I come up with for running commands automatically on a batch of servers:
usage: ./batch-cmd.sh file cmd Each host in one line in the file
ssh $host "ls"