0

Let's say I've 50 servers running same name screen sessions and all servers have same password.

Is there a way I can put all server IP in one bash file with passwords and login using PSSH and resume (join existing) screen sessions in all servers at the same time and execute same commands using PSSH?

0

Yes. Although, since they all have the same credentials, I think what you want would be better achieved by pdsh.

You need to ensure that you have set up ssh between the servers so you can login without a password. Install the pdsh package if you don't already have it. Once installed you can do something like:

pdsh -R exec -w ^hosts.txt screen -D -R

Please note I don't now the actual screen command you want to use. However you can execute any command,script or list of commands in parallel. The above will execute at the same time, to a list of hosts defined in the host.txt file.

pdsh is a great tool for managing groups of servers, where you need to issue commands in parallel. Look at the man page for pdsh there are lots of options. A good one to note is PDSH_SSH_ARGS_APPEND variable, this will let you append options from the normal ssh command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.