Remote Command Runner

Go application for running shell and PostgreSQL commands via SSH on remote servers.


Remote Command Runner is a a lightweight local DevOps tool for running shell or PostgreSQL commands on a number of remote servers simultaneously.

The tool is intended to run on an admin's local machine. It uses the local SSH config file to find out which connections are possible, then automatically starts a local web server, which can be viewed on a configurable localhost port, in order to provide a UI for server connection and issuing of commands, as shown above. Further usage details and download links are below.


Language and 3rd party libraries

The program is written in Go. It uses several external packages in addition to the standard library:


  1. You need to have a SSH config file on your computer (see here for more details). The location is configurable
  2. The SSH config file may have a single wildcard host (*), but may not have attributes shared by multiple named hosts
  3. The tool is most effectively used if the hosts in the config file are named consistently, with a group designation suffixed with a hyphen, e.g. server1-test, server1-live, server2-test, etc
  4. In order to run remote database commands, the database must be Postgres and the database name must be the same on all servers

Download and setup

  1. Download the zipped config and frontend files and unpack them into a directory
  2. Download the appropriate executable for your OS (Linux, Mac, Windows) and move it into the same directory
  3. Open config.toml in a text editor to make these changes:
  4. If your SSH config file is not under the standard location, "~/.ssh/config", change it using the setting "SSHConfigFile"
  5. If you have named the hosts using the method shown above, e.g. server1-test, server1-live, server2-test, then change the setting "ServerGroups" to match the suffixes (groups) you have defined
  6. Change the setting "RemoteDb" to the name of the Postgres database on which the commands should be run


  1. In the command prompt, cd to the directory containing the executable and the unpacked config and frontend files
  2. Run the executable: ./datafile_analyzer_linux_amd64-0.1
  3. Your SSH config file will be read and processed and the prompt will say starting server
  4. In your browser, go to localhost:8000 to view the results
  5. If desired, select a server group to filter the list of servers
  6. Select one or more servers and press Connect. This will establish an SSH connection to those servers using the information from the SSH config file. A connected server will appear with a green background
  7. Either: enter a shell command and press Execute shell; or enter an SQL command and press Execute SQL. This will attempt to run the command on all connected servers
  8. You may continue to run commands via the open connections
  9. Select the connected servers and press Disconnect, or simply terminate the process with Ctrl-C


Failed to run command: Process exited with status x

  1. If a command fails to run, the full error message from the remote session is unfortunately not shown. In this case, check the spelling of the command / the validity of the SQL. If it still fails, manually SSH to the server on which it fails and run the command manually, to see what the problem is


Configuration of the tool is handled by the file config.toml, which was part of the zipped archive and can be edited with any text editor. This file is read upon each execution of the program. Each of the settings has a comment for explanation.

comments powered by Disqus