rgo

command module
v0.0.0-...-6862e2e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2019 License: MIT Imports: 11 Imported by: 0

README

rGo

rGo means "Ready? Go!" or "remote go" ~
It can execute commands(or a shell script) on multiple remote hosts almost at the same time

Usage

common

Edit config.json to config the remote hosts. For example:

[
  {"host":"1.1.1.1"},
  {"host":"1.2.3.4"},
  {"host":"4.3.2.1"}
]

ready? let's go

./rGo -u root -p -c "cd /tmp; touch abc"

and a promtp appears:

Please enter the password:

after entered the password (which will not be showed),
rGo will login to each host and execute your commands.

Another example

config.json:

[
  {"host":"localhost"},
  {"host":"1.1.1.1"},
  {"host":"1.2.3.4", "user":"abc", "password":"xxx"},
  {"host":"2.2.2.2", "user":"ttt", "password":"vvv"},
  {"host":"4.3.2.1", "user":"kkk", "key_files":["~/.ssh/id_rsa"]}
]

If host is 'localhost' or '127.0.0.1', commands will be executed locally
'password' and 'key_files' are optional, just for authentication

./rGo -c "echo Hello; ls ~"

or you can execute a shell script with the "-sh" option, like:

./rGo -sh test.sh

Help info

You can type this line:

./rGo --help

to get a breif help info:

Usage of rGo:
  -c string
	commands (can be separated with ";")
  -sh string
	shell script to be executed

  -u string
	if there is no "user" field of some record in config.json,
	value of this option will be used
  -p
	if there is no "paasword" or "key_files" field of some records in config.json,
	we can use this option and then enter the paasword

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
util
cmd
ssh

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL