Batch exec command on servers & written by golang.
- Exec command on cluster servers.
- Server clusters support.
- Hosts support simple preg(just IPs).
- scp supported(using sftp), can upload file to batch servers(NOTE: supported file only).
Get the package, add the src to workspace path and build it.
But, first you should get golang ssh packages
$ git clone github.com/youngsn/go-ssh
$ go build -o bsh -v -x $GOPATH/go-ssh/src/main.go
$ cp go-ssh/elfgate.yml /etc/
$ sudo cp bsh /usr/local/bin/
$ bsh uptime # example
Usage:
Execute command just like below, the outputs will print on screen or using > redirect to file.
Now also sudo command are supported, but at first you should enter password if not config pasword.
- -c, config file location, default: /etc/elfgate.yml
- -t, command timeout, default: 0, no timeout
- -g, groups that execute commands, default: default
- enter command directly.
$ bsh -c $CONF -t $TIMEOUT -g $GROUP $CMD
If you want to upload file to batch server, just do like below. Very easy and now only supported file, not directory.
$ bsh -c $CONF -g $GROUP scp $LOCAL_PATH $REMOTE_PATH
username: youngsn # server username
password: # login password, if don't config, you will enter through stdin
public_key: # ssh public authorized key path, if using this, add here
groups:
default: # Group default
- 127.0.0.[1-5] # simple preg support
- 127.0.0.[6-7]:233
- 127.0.0.8 # default port 22
- 127.0.0.9:25 # port 25
example: # Group example
- 127.0.0.2
- 127.0.0.3:25
Use below third packages.
Interactive cmds solution.
TangYang youngsn.tang@gmail.com
Released under the MIT License.