# SSH

> Run commands on your own servers over SSH and use what they print.

App · 1 action. Web page: https://docs.lodol.com/docs/integrations/ssh

## Actions

### Run a command

Run a command on the connected server, as you would type it at its prompt, and get back what it printed and its exit code. Use it to deploy, restart a service, check disk space, read a log, or run a script that lives on the server.

**Inputs**

- Command (`command`, text, required): What to run on the server, exactly as you would type it at its prompt. It runs as the connected user, in that user's shell, so chain commands with && and quote values that contain spaces. Values from earlier steps can be put into it.
- Working directory (`working_directory`, text): Run the command from this folder on the server, such as /var/www/app. Leave it empty to run from the user's home folder.
- Time limit (seconds) (`timeout`, number): Stop the command and fail the step if it has not finished within this many seconds. A command that waits for input never finishes, so give it none. From 1 to 3600. Default: `60`.
- If the command fails (`on_error`, text): What to do when the command exits with a status other than 0. Continuing lets later steps read the exit code and the error output themselves, which suits a check whose failure is an answer rather than a problem. One of: `fail` (Stop the workflow), `continue`. Default: `fail`.

**Outputs**

- `exit_code` (number): The command's exit status: 0 when it succeeded. -1 when it ended without reporting one, which usually means it was killed.
- `ok` (true/false): Whether the exit code was 0.
- `stderr` (text): What the command printed to its error stream, without the line break it ended with. Many commands print progress and warnings here even when they succeed.
- `stdout` (text): What the command printed, without the line break it ended with.

**Example output**

```json
{
  "exit_code": 0,
  "ok": true,
  "stderr": "",
  "stdout": "Filesystem      Size  Used Avail Use% Mounted on\n/dev/sda1        80G   41G   39G  52% /"
}
```
