Reputation: 35129
I'm trying to execute command on multiple servers through ssh, that's what I'm trying to do:
for i in {1..3}; do `ssh nginx_$i ps aux | grep logstash`; done
But it tells me to install some package:
The program 'root' is currently not installed. You can install it by typing:
sudo apt-get install root-system-bin
I'm not convinced that I need to install it, because if I do
ssh nginx_1 ps aux | grep logstash
It works, and gives me the correct result.
P.S. Assuming that I have configured .ssh/config
file to connect to nginx_1
, nginx_2
and nginx_3
.
Upvotes: 0
Views: 1273
Reputation: 182649
for i in {1..3}; do `ssh nginx_$i ps aux | grep logstash`; done ^ ^
Drop the backquotes. If you include them, the shell will try to execute the output of the command.
Upvotes: 4