> For the complete documentation index, see [llms.txt](https://docs.gotempest.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gotempest.app/productivity/snippets-scheduled-runs.md).

# SSH Snippets & Scheduled Commands

Save reusable shell commands as Tempest Snippets and run them on a schedule across one or many SSH hosts, with cross-device notifications on failure.

**Snippets** are Tempest's saved shell commands — paste a command once, give it a name, and re-run it on any host with a click. **Scheduled runs** turn snippets into cron jobs that fire on the hosts you choose, with notifications routed to your phone via [Tempest Push](/productivity/tempest-push-notifications.md) when a run fails.

It's the missing layer between "I keep retyping the same `journalctl -u …`" and "I don't want to set up Ansible just for three commands."

## Save a snippet

1. Open the **Snippets** panel.
2. Click **New Snippet**.
3. Paste your command (multi-line is fine — bash heredocs, pipelines, etc.).
4. Give it a name and optionally a description.
5. Save.

Snippets sync across your devices via your encrypted vault, just like hosts.

## Browse them as files — Tempest Drive

Everything you save lives in **Tempest Drive**, which is browsed the same way as an SFTP or S3 location: folders, a sort menu, and the same rows, icons, sizes and modified dates the file manager uses. A folder is created by naming it when you save a document.

Browsing Drive is available on every plan. Creating, renaming, moving, deleting and attaching files are **Pro**.

## Attach files to a document (Pro)

A document is a command *and* the files that belong with it — a runbook beside the script it describes, a spreadsheet beside the query that produces it, a screenshot of the error you are chasing.

1. Open the document.
2. Use the attach button, or drag files onto the file strip below the editor.
3. Open an attachment to view it in Tempest, or hand it to your system's default application.

Attachments are encrypted with the rest of your vault and sync to your other devices. They can also be read by Copilot — see [Tempest AI Assistant](/productivity/tempest-ai-assistant.md).

## Run a snippet

* In any SSH tab, open the snippet panel and pick one — Tempest sends it through the channel
* Or **target multiple hosts** at once: pick the snippet, select hosts from your list, run. Each host gets its own output panel.

## Schedule a snippet

A schedule can be set while you create the snippet, or added later from an existing one.

1. Open a snippet → **Schedule** tab.
2. Set the cron expression (UI helper for common patterns: every hour, every day at 3 AM, etc.).
3. Pick targets: one host, a tag-matched group, or all hosts.
4. Optional: enable **Notify on failure** → exit code ≠ 0 triggers a Tempest Push to your phone.
5. Save.

The schedule runs **in the Tempest backend** (Electron main process / standalone server), not in the renderer. So:

* Your laptop can be asleep and the run still happens — as long as the Tempest backend is up.
* On the **standalone Tempest server**, schedules survive even if no client is connected (perfect for lightweight ops automation).

## Run history

Each scheduled run records:

* Start / end timestamp
* Exit code
* Stdout / stderr captured (configurable size limit)
* Per-target status when running fan-out

Browse history in **Snippets → History** with filters by snippet, host, and status.

## When to use snippets vs. an actual config-management tool

| Use Snippets when                                                       | Use Ansible / Puppet / Salt when                  |
| ----------------------------------------------------------------------- | ------------------------------------------------- |
| 1–10 hosts                                                              | Hundreds of hosts                                 |
| Operational commands ("show me the disk usage", "restart this service") | Declarative state ("nginx must be installed")     |
| You want one-shot fan-out from your laptop                              | You want a CI pipeline triggering converged state |
| Quick fix for a specific incident                                       | Reproducible infrastructure                       |

The two complement each other — snippets handle ad-hoc operational tasks, real config-management tools handle long-lived state.

## Pro feature

Scheduled runs are part of **Tempest Pro**. Saving and one-off running of snippets is free.

## See also

* [Tempest Push Notifications](/productivity/tempest-push-notifications.md) — how failure alerts reach your phone
* [Tempest AI Assistant](/productivity/tempest-ai-assistant.md) — generate snippet content from a natural-language description
