Run on hosts
Run on hosts runs one command, or a few lines of shell script, on each host you pick. No terminal opens: ZestSSH signs in to the hosts a few at a time, runs the command, and shows for each host what it printed and how the command ended. You can copy the results and run the command again where it failed.
Run on hosts is a computer feature (Windows, macOS, Linux).
Open it
Section titled “Open it”- In a session’s header, open Broadcast and choose Run one command on several hosts.
- In the command palette, choose Run on hosts… (under Sessions).
- On the Snippets page, open a snippet’s menu (right-click it, or its three dots) and choose Run on hosts…. The snippet’s command is filled in.
Run a command
Section titled “Run a command”- Type the command in Command, or pick one with From a snippet (shown once you have snippets). Several lines run as a script.
- Tick the hosts. Search by name, address or group; a group’s box ticks every host in it.
- Choose the button that names how many hosts, for example Run on 3 hosts.
- Answer what ZestSSH asks first (see What is asked first).
Each host is signed in to the way a session to it would be: the network your device is on, its jump hosts, its own key or password. A password, a question from the server or a new host key is asked of you, one question at a time.
What is asked first
Section titled “What is asked first”Before anything runs:
- Variables. A command with variables such as
${SERVICE}asks for their values, as a snippet does. A variable written${VAR:secret}or${VAR:password}is masked: its value is hidden wherever the command is shown or copied, and left out of a team’s log. What a host prints is shown as it is. See Snippets. - Risky commands. With Dangerous command protection on (in Settings > Security), a command that could do lasting harm, such as
rm -rforshutdown, asks “Run this command?” with what was found. Choose Run anyway to go on. Ticking Don’t ask again there turns the protection off. - A snippet that asks first. Otherwise, a snippet set to ask before it runs asks “Run this snippet?”.
Cancelling any of these runs nothing.
The results
Section titled “The results”While the command runs, the top line counts the hosts that are through. Each host’s row says where it stands:
| Row | Meaning |
|---|---|
| Waiting | Its turn has not come. |
| Signing in | ZestSSH is signing in to it. |
| Running | The command runs. |
| Done | The command ended with exit status 0. |
| Exit status and a number | The command ended with that exit status. |
| Ended by and a signal | A signal ended it. |
| Ended, no exit status | The host gave no exit status. |
| Failed | It could not run, or did not end: the row says why, for example that sign-in failed. |
| Stopped | You stopped the run before this host was through. |
A row that is through opens to what the host printed, as Output and Errors, and for a failed host what happened and what may help, with Copy details. Each row also shows how long it took.
When every host is through, the top line says how many ended well and how many did not. Then:
- Copy all results copies the command and every host’s result and output. Masked values in the command stay hidden.
- Run again where it failed runs the same command again on the hosts that did not end well.
- New run starts again with the same command and hosts, to change them.
- Stop, while it runs, lets go of every host: hosts whose turn has not come are not run on, and a command already running on a host may go on there.
You can close the dialog while a run goes on. Opening Run on hosts again shows it where it stands, and the last run stays until you start a new one.
Limits
Section titled “Limits”- Four hosts at a time. Up to four hosts are signed in to and run on at once; the others wait their turn.
- Two minutes for each command. A command that has not ended after 2 minutes is let go of. It may still be running on the host, and what it printed until then is kept.
- No terminal and no input. The command gets no terminal and nothing is typed into it. A program that draws a full screen does not work, and a command that waits for input, such as a password prompt, waits until its 2 minutes are up.
- 256 KiB of output. For each host, the first 256 KiB of output and of errors are kept.
- SSH hosts only. A Mosh, Eternal Terminal, Telnet, serial or local shell host fails, and its row says “Run on hosts works with SSH hosts only. Open this one in a session instead.”
- Free plan: a run takes up to 4 hosts. Squeezed has no limit (see pricing). A run does not count as a session.
- One run at a time. Installing a key on hosts is a run of its own and does not take this one’s place. See Install a key on hosts.
- Teams: a host whose team watches its sessions is not run on (see Session sharing and moderation), and a host whose team logs its sessions has the run in its team’s log, marked Logged in its row (see Team session logs). Masked values are left out of the log.
Run on hosts or broadcast?
Section titled “Run on hosts or broadcast?”| Run on hosts | Broadcast | |
|---|---|---|
| What it does | Runs one command on each host, without a terminal | Types what you type into several open terminals at once |
| Terminals | None open | The terminals must be open, each one showing its host |
| Results | Each host’s output and how it ended, to read, copy and run again | You read each terminal yourself |
| Interactive programs | No | Yes, with care: each terminal gets the same keys |
| Where | Computers | On a computer, the terminals of one tab; on a phone, the sessions you pick |
Use Run on hosts to change or check many hosts and see at a glance where it failed. Use broadcast to work in several shells side by side.