If you manage multiple servers, or even just a few, this command might come in handy. It’s called dsh – distributed shell. It acts very similar to the ssh command but will run the command to all servers you pass to it via the -m switch. Distributed shell can run the commands simultaneously with a max threshold, or one at a time.
It might be installed already, if not you can install it easily.
Debian & Ubuntu Install
sudo apt-get -y install dsh
This example will restart the elasticsearch service on all these servers at the same time.
Example
dsh -m 10.3.10.1 -m 10.3.10.2 -m 10.3.10.3 -m 10.3.10.4 -a -c -- service elasticsearch stop
See the man page for more useful options.
man dsh