- Renamed internal functions with `cl_` prefix to avoid name collisions with user-defined script functions - Added support for a client environment file: /etc/calculate/remote-client.env (sourced directly instead of using `cat`, for ash compatibility) - Added `--nocolor` option to disable colored output (useful for logs and scripts) - Introduced `cl_prepare_script()` to invoke `prepare()` function from user scripts before execution - Updated scripts `netspeed`, `notify`, `rename-iface`, `upgrade`, and `version`: - All logic moved into `run()` functions - Added `prepare()` where argument validation is needed - Improved robustness under `set -euo pipefail` - Improved output formatting - Removed CLI usage examples from help output to improve readability |
||
---|---|---|
locale | ||
scripts | ||
.gitignore | ||
CHANGELOG.md | ||
cl-remote | ||
LICENSE | ||
Makefile | ||
README.md | ||
remote-client.env.example | ||
remote.env.example |
cl-remote - Fast and Parallel Execution of Commands on Remote Workstations
cl-remote is a tool for automating command execution on remote Linux machines. Part of the app-admin/calculate-remote
package, used in Calculate Linux.
Features
- Fast network scanning and command execution (~1 sec).
- Machine discovery by port (default: 22).
- Parallel execution with customizable threads.
- Supports commands and scripts:
netspeed
,notify
,upgrade
,version
. - Localization (fr, pl, ru).
Installation
Via Package Manager
emerge -a app-admin/calculate-remote
From Source
make && make install
cp /etc/calculate/remote.env.example /etc/calculate/remote.env
Usage
Syntax:
cl-remote [options] -- [command]
Examples:
- On all machines:
cl-remote -n testnet -- who
- On a single host:
cl-remote -H 192.168.1.10 -- uptime
- Script:
cl-remote -s notify "Update" "Reboot!"
Details: cl-remote -h
.
Configuration
File: /etc/calculate/remote.env
. Example:
NET='testnet'
NET_ADDR=(testnet "192.168.1.{1..10}")
JOBS=10
SSH_KEY="/root/.ssh/id_ed25519"
Setting Up SSH Keys for cl-remote
For cl-remote
to work over SSH, you need to set up passwordless authentication by distributing your public SSH key to all target machines. This can be done using ssh-copy-id
. Follow these steps:
-
Generate an SSH Key (if not already created):
ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519
Press Enter to accept the default values if you don’t want to set a passphrase for the key.
-
Copy the Public Key to Remote Machines: For each machine, run:
ssh-copy-id -i /root/.ssh/id_ed25519.pub root@192.168.1.10
Replace
root@192.168.1.10
with the appropriate address and user. You’ll be prompted to enter the password manually once. -
Test the Connection:
ssh -i /root/.ssh/id_ed25519 root@192.168.1.10
If configured correctly, you should log in without a password prompt.
-
Specify the Key in
cl-remote
Configuration: Ensure the path to the private key is correctly set in/etc/calculate/remote.env
:SSH_KEY="/root/.ssh/id_ed25519"
With this setup, cl-remote
can execute commands on remote machines without requiring a password.
Note
If you’re using a non-standard SSH port (other than 22), specify it when copying the key:
ssh-copy-id -i /root/.ssh/id_ed25519.pub -p 2222 root@192.168.1.10
Adjust cl-remote
accordingly using the -p
option or in the configuration.
Requirements
- OS: Calculate Linux or another Linux system.
- Dependencies:
bash
,ssh
,iproute2
,gettext
,openssh
(required for SSH andssh-copy-id
).
License
Apache 2.0 (text).