Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhuzilin/nezha
Organizing ssh servers in one shell.
https://github.com/zhuzilin/nezha
shell ssh
Last synced: about 11 hours ago
JSON representation
Organizing ssh servers in one shell.
- Host: GitHub
- URL: https://github.com/zhuzilin/nezha
- Owner: zhuzilin
- License: mit
- Created: 2021-12-09T11:02:42.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-13T08:49:30.000Z (almost 3 years ago)
- Last Synced: 2024-10-29T00:56:31.272Z (22 days ago)
- Topics: shell, ssh
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 10
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NeZha (哪吒)
[NeZha](https://en.wikipedia.org/wiki/Nezha) is a famous chinese deity who can have three heads and six arms if he wants. And my NeZha tool is hoping to bring developer such multitask ability when handling multiple remote ssh servers.
NeZha is built upon [Fabric](https://github.com/fabric/fabric).
## Installation
```bash
pip3 install nezha-ssh
```## Usage
NeZha will simultaneously connect the ssh servers you configed and run command on all of them.
To run certain command:
```bash
python3 -m nezha -H ./test_config --cmd pwd
```And if you need different commands for different server, you can pass the command line as a format string in python:
```bash
python3 -m nezha -H ./test_config --cmd "echo {NEZHA_ID}"
```The `{NEZHA_ID}` will be interpreted as 0 to n, corresponding the order of host in the host file (the file you send to `-H`). Other possible values are `{NEZHA_IP}`.
And you can run shell script with:
```bash
python3 -m nezha -H ./test_config --file test.sh
```To use REPL:
```bash
python3 -m nezha -H ./test_config --repl
```The `host_config`(`-H`) file should be similar to the ssh config, for example:
```
# lines started with hash sign will be treated as comment.
Host A
User alice
HostName 127.0.0.1Host B
User bob
HostName 127.0.0.1
```