where computers is a file with one IP-adress on each line and command is the actuall command you want to run. (modify path to your ssh binary as needed, for security reasons use an absolute path)
You should setup SSH-keys aswell. You can use ssh-copy-id for that so you wont need to enter a password everytime you run the script, for each server.
You can use ssh for that. For example:
You may want to have a list of servers stored in a environment variable:
and a function (for example) in your bashrc (or a dedicated script):
so you can call it whenever you want to do tasks for each of your servers. For example rename files as you wanted:
or (just to show you how to scape the command to pass through ssh):
Obviously this can be as robust as you wish (enabling arrays of servername/sshport), syntax checks, etc...
While not a bash script, you might also like to try ClusterSSH. It will help you to execute the same command on multiple servers at the same time.
You can use a one-liner perl:
where computers is a file with one IP-adress on each line and command is the actuall command you want to run. (modify path to your ssh binary as needed, for security reasons use an absolute path)
You should setup SSH-keys aswell. You can use ssh-copy-id for that so you wont need to enter a password everytime you run the script, for each server.