Files
rexec/README.md

63 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

2023-06-18 13:22:06 +03:00
# rexec
2023-08-31 23:30:37 +03:00
**Parallel SSH executor** in Rust with static binary. It can read servers from `~/.ssh/known_hosts`
2023-06-20 02:59:28 +03:00
2023-08-31 23:19:26 +03:00
or even expand servers from bash expanshion line `cassandra-[1:5].{prod,dev}.example.com`
2023-08-31 23:34:02 +03:00
2023-08-31 23:31:10 +03:00
[![Rust-static-build](https://github.com/house-of-vanity/rexec/actions/workflows/release.yml/badge.svg)](https://github.com/house-of-vanity/rexec/actions/workflows/release.yml)
2023-08-31 23:34:02 +03:00
---
2023-06-20 00:38:10 +03:00
2023-08-31 23:34:02 +03:00
## Usage
2023-08-31 23:31:10 +03:00
```shell
2023-08-31 23:30:37 +03:00
_|_|_|_| _| _| _|_|_|_| _|_|_|
_| _|_| _| _| _| _| _|
_|_| _|_|_| _| _|_|_| _|
_| _| _| _| _| _|
_| _|_|_|_| _| _| _|_|_|_| _|_|_|
2023-06-20 02:59:43 +03:00
2023-06-20 02:35:46 +03:00
Parallel SSH executor in Rust
Usage: rexec [OPTIONS] --expression <EXPRESSION> --command <COMMAND>
2023-06-18 13:22:06 +03:00
Options:
2023-06-20 02:35:46 +03:00
-u, --username <USERNAME> [default: ab]
-k, --known-hosts Use known_hosts to build servers list
-e, --expression <EXPRESSION> Expression to build server list
-c, --command <COMMAND> Command to execute on servers
--code Show exit code ONLY
-f, --noconfirm Don't ask for confirmation
-p, --parallel <PARALLEL> [default: 100]
-h, --help Print help
-V, --version Print version
2023-06-20 02:41:02 +03:00
```
2023-08-31 23:34:02 +03:00
---
2023-06-20 02:35:46 +03:00
2023-09-07 17:01:23 +03:00
![image](https://github.com/house-of-vanity/rexec/assets/4666566/4c52915d-2bc1-46b9-9833-b0d7c0527f2d)
2023-08-31 23:25:16 +03:00
2023-09-07 17:01:23 +03:00
## Examples
2023-08-31 23:34:02 +03:00
```shell
2023-09-07 17:01:23 +03:00
$ rexec -f \
-e 'cassandra-gce-or-[1:2]' \
-u ab \
-c 'uname -r; date'
[INFO ] Using string expansion to build server list.
2023-06-18 13:22:06 +03:00
[INFO ] Matched hosts:
2023-09-07 17:01:23 +03:00
[INFO ] cassandra-gce-or-1.prod.example.com [2.22.123.79]
[INFO ] cassandra-gce-or-2.prod.example.com [2.22.123.158]
Continue on following 2 servers? y
[INFO ] Run command on 2 servers.
cassandra-gce-or-1.prod.example.com
Exit code [0] / stdout 45 bytes / stderr 0 bytes
STDOUT
║ 5.15.0-1040-gcp
║ Thu Sep 7 13:44:40 UTC 2023
cassandra-gce-or-2.prod.example.com
Exit code [0] / stdout 45 bytes / stderr 0 bytes
STDOUT
║ 5.15.0-1040-gcp
║ Thu Sep 7 13:44:40 UTC 2023
2023-06-18 13:22:06 +03:00
```