Skip to content

justinfenn/mcmd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mcmd

Mcmd is a simple utility to run commands on predefined sets of hosts. It's a lot like ssh user@host <command>, but it works on multiple targets at the same time.

Usage

Download and install:

go get github.com/justinfenn/mcmd

Define a host file and run:

mcmd hosts.yaml uptime

mcmd hosts.yaml tail /var/log/my-app/out.log

Mcmd will first try to treat the host file parameter as a path to the file. If no file is found at the path, it will look in $XDG_CONFIG_HOME/mcmd or $HOME/.config/mcmd. Don't specify the extension in the parameter if the host file lives in one of the config directories.

mcmd prod-servers df -h

Note: The target hosts need to have correct entries in a known_hosts file. The easiest way to ensure this is done is to connect to each host using ssh first. Mcmd will look for a known_hosts file in $HOME/.ssh/known_hosts.

Host files

Connection information is specified in host files. By default, mcmd will attempt to authenticate using an ssh agent. If an agent with the required key(s) is running, no auth configuration is needed. You can also specify a private key for mcmd to authenticate with (currently only passphraseless keys are supported). Mcmd will ask for a password if neither of the above conditions are met.

Use ssh agent or password auth:

user: my-username
hosts:
  - host1
  - host2:2222 # custom port

Specify private key:

user: my-username
privatekey: $HOME/.ssh/my_key_rsa
hosts:
  - host1
  - host2
  - host3
  - host4

About

Run commands on multiple hosts simultaneously

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages