No description
Find a file
Alexander Tratsevskiy cbbe1855ad feat: refactor cl-remote and scripts for modularity and ash compatibility
- 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
2025-04-15 15:50:28 +03:00
locale translation update 2025-04-10 01:11:29 +03:00
scripts feat: refactor cl-remote and scripts for modularity and ash compatibility 2025-04-15 15:50:28 +03:00
.gitignore Localization into English 2025-03-17 18:05:30 +03:00
CHANGELOG.md Update changelog 2025-04-10 01:16:28 +03:00
cl-remote feat: refactor cl-remote and scripts for modularity and ash compatibility 2025-04-15 15:50:28 +03:00
LICENSE Add license and update scripts 2025-03-28 15:58:11 +03:00
Makefile Set install mode 644 for scripts to avoid unnecessary executable permissions 2025-03-28 12:14:00 +03:00
README.md Обновить README.md 2025-03-21 21:41:16 +03:00
remote-client.env.example feat: refactor cl-remote and scripts for modularity and ash compatibility 2025-04-15 15:50:28 +03:00
remote.env.example feat: refactor cl-remote and scripts for modularity and ash compatibility 2025-04-15 15:50:28 +03:00

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:

  1. 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 dont want to set a passphrase for the key.

  2. 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. Youll be prompted to enter the password manually once.

  3. 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.

  4. 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 youre 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 and ssh-copy-id).

License

Apache 2.0 (text).