Assuming TXTFILE contains the addresses and YOURSCRIPT is your script. First, ensure your ssh key is on all the servers:
Code:
ssh-keygen # only needed if you have no key
for address in $(cat TXTFILE)
do
ssh-copy-id $address
done
This requires you entering the password at each remote server. It's not required, but it allows you to log on to the servers in the future without entering a password.
Next, copy the script to the servers. For example:
Code:
for address in $(cat TXTFILE)
do
scp YOURSCRIPT ${address}:
ssh chmod +x ${address}:YOURSCRIPT
done
At any time execute it:
Code:
for address in $(cat TXTFILE)
do
ssh ${address}:YOURSCRIPT
done
There are more sophisticated ways to do this. Ansible comes to mind, but it requires more preparation and has a certain learning curve.