2024-12-13 13:22:49 +01:00
|
|
|
# multi-ssh
|
|
|
|
|
|
2024-12-15 14:34:19 +01:00
|
|
|
An application to upload or edit a file or perform a command on multiple servers via ssh and scp.
|
2024-12-13 13:22:49 +01:00
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
2024-12-14 17:58:13 +01:00
|
|
|
Set the environment variable `MSSH_SERVERS` to configure the server directories of your ssh servers.
|
2024-12-15 14:34:19 +01:00
|
|
|
Use the `MSSH_EDITOR` variable to configure your editor command.
|
2024-12-14 17:58:13 +01:00
|
|
|
Furthermore, ensure that in your shell the following commands are set up and working:
|
|
|
|
|
- ssh
|
|
|
|
|
- scp
|
|
|
|
|
- ssh-agent
|
|
|
|
|
- ssh-add
|
|
|
|
|
|
|
|
|
|
Ergo you should be able to connect to your desired servers via ssh and be able to start an ssh agent.
|
2024-12-13 13:22:49 +01:00
|
|
|
|
2024-12-15 14:34:19 +01:00
|
|
|
### Environment variable setup example for linux
|
2024-12-13 13:22:49 +01:00
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
export MSSH_SERVERS="crea:server/creative2,sky:sky,city:city2"
|
2024-12-15 14:34:19 +01:00
|
|
|
export MSSH_EDITOR="kate -b <file>" #<file> is the placeholder for the file name
|
2024-12-13 13:22:49 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
For detailed usage please see:
|
|
|
|
|
```bash
|
|
|
|
|
multi-ssh --help
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Command example
|
|
|
|
|
|
|
|
|
|
Delete the WorldGuard folder on crea, sky and city:
|
|
|
|
|
```bash
|
|
|
|
|
multi-ssh crea sky city -c "rm -r plugins/WorldGuard"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Upload example
|
|
|
|
|
|
|
|
|
|
Upload a new version of the MenuApi plugin and delete old versions from the servers:
|
|
|
|
|
```bash
|
|
|
|
|
multi-ssh crea sky city minez lobby -u target/MenuApi-3.4.2.jar
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Upload a new version of the MineZ plugin but keep backups of the older versions:
|
|
|
|
|
```bash
|
|
|
|
|
multi-ssh minez -u target/MineZ-3.0.jar -a
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The program will show you an overview of what it will be doing before actually performing any of the actions:
|
|
|
|
|
```
|
|
|
|
|
minez:
|
|
|
|
|
* renaming MineZ-2.7.jar -> MineZ-2.7.jarr
|
|
|
|
|
+ adding MineZ-3.0.jar
|
|
|
|
|
Continue [Y|n]:
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
For detailed usage of the upload feature see
|
|
|
|
|
```bash
|
|
|
|
|
multi-ssh -u --help
|
|
|
|
|
```
|
2024-12-14 17:58:13 +01:00
|
|
|
|
2024-12-15 14:34:19 +01:00
|
|
|
### Editor example
|
|
|
|
|
|
|
|
|
|
Edit the server properties of steptech
|
|
|
|
|
```bash
|
|
|
|
|
multi-ssh steptech -e server.properties
|
|
|
|
|
```
|
|
|
|
|
Note that the above command will create a `.mssh` folder in your current working directory. That directory can be
|
|
|
|
|
changed with the `-d` flag.
|
|
|
|
|
|
2024-12-14 17:58:13 +01:00
|
|
|
## Building from source
|
|
|
|
|
|
2024-12-14 17:59:05 +01:00
|
|
|
This is a rust project so you will need [rust and cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html).
|
2024-12-14 17:58:13 +01:00
|
|
|
|
|
|
|
|
Once you have that installed, just run
|
|
|
|
|
```bash
|
|
|
|
|
cargo build --release
|
|
|
|
|
```
|
|
|
|
|
and you will find an executable in `target/release`.
|
2024-12-18 11:35:38 +01:00
|
|
|
|
|
|
|
|
### Unit tests
|
|
|
|
|
|
|
|
|
|
In order for the unit tests to pass, you will need `python3`
|