Skip to content

iOS Shortcuts examples

On iPhone and iPad, a shortcut opens ZestSSH with a zestssh:// link, from the Shortcuts app’s Open URLs action; ZestSSH opens to do the work. From 4.0 (iOS 16 and later), ZestSSH also has actions of its own in the Shortcuts app, Connect via SSH, Run SSH Command and Run SSH Snippet, which open the same links for you. See iOS Shortcuts.

From Shortcuts What happens
A zestssh://connect link ZestSSH asks Connect to web-01? and opens a session when you tap Connect
A zestssh:// link with your API key (execute, snippet, batch, workflow) ZestSSH asks Run this from a link? and runs it when you tap Run

Every link that runs something waits for Run, so a shortcut started by a time or a place stops at that question until you answer it. There is no way to skip it on iOS. ZestSSH’s own scheduled tasks run on Android and on computers, not on iOS.

For the links that run something:

  1. In ZestSSH, open More > Automation and turn on External automation (needs Squeezed).
  2. Tap API keys and create a key. Copy it from Save your API key: ZestSSH shows it only once, and keeps only a hash of it.
  3. In Keys, open the key the host signs in with and turn on Allow unattended runs. A link’s run counts as one with nobody there once you tap Run.
  4. Connect to the host yourself once, so ZestSSH trusts its host key.

A zestssh://connect link needs none of this: it opens a session as you would.

Purpose: open a session to web-01 from a shortcut or Siri.

  1. In the Shortcuts app, create a new shortcut named “Web server”.

  2. Add the Open URLs action, with this link (the host’s name in ZestSSH, in any letter case, or id= and its ID):

    zestssh://connect?name=web-01
  3. Run the shortcut, or say “Hey Siri, Web server”. ZestSSH opens and asks Connect to web-01?. Tap Connect.

ZestSSH looks for the host in your personal space. If no host has that name, it says “No host named web-01 is saved in your personal space.”

Purpose: see how long web-01 has been up.

  1. Create a new shortcut.

  2. Add the Open URLs action, with this link:

    zestssh://execute?connection=web-01&command=uptime&key=YOUR_API_KEY
  3. Run the shortcut. ZestSSH opens and asks Run this from a link?. Tap Run.

The command’s output is in More > Automation > Automation history.

Purpose: restart nginx on web-01.

  1. Create a new shortcut.

  2. Add the Shortcuts action that opens a URL, with this link:

    zestssh://execute?connection=web-01&command=systemctl%20restart%20nginx&key=YOUR_API_KEY&timeout=15
  3. Run the shortcut. ZestSSH opens and asks Run this from a link?, showing “A link asks to run this command on web-01:” and the command. Tap Run.

The run asks for nothing, so sudo works here only where the server lets the command run without a password. The question itself is the confirmation: you do not need one of your own in the shortcut.

Example 4: a morning report as a notification

Section titled “Example 4: a morning report as a notification”

Purpose: see the uptime and disk use of your servers as a notification.

A link returns nothing to the shortcut, and a callback in a link is ignored. A saved workflow’s Notify step can show you the output instead:

  1. In ZestSSH, open More > Automation > Workflows and create a workflow named Morning report.

  2. Add an Execute command step that runs uptime && df -h / on web-01. Leave the workflow switched on in the workflow list, so a link can start it.

  3. Add a Notify step after it. Leave its message empty to show the output of the step before, or write a message with {{output}} where the output goes.

  4. In the Shortcuts app, create a shortcut that opens this link:

    zestssh://workflow?name=Morning%20report&key=YOUR_API_KEY
  5. Run the shortcut and tap Run in ZestSSH. When the workflow ends, the Notify step shows a notification with the output (up to 500 characters).

A key limited to one host cannot run a workflow: use a key with All hosts, which every key made on a phone has.

To run it every morning, start the shortcut from a Shortcuts automation at the time you want. ZestSSH still asks Run this from a link? when it opens.

Siri runs any shortcut by its name: say “Hey Siri” and the shortcut’s name. From 4.0, Siri also knows ZestSSH’s own actions by phrases such as “Run SSH command with ZestSSH”; see iOS Shortcuts.

A shortcut can build the link from its own values, for example a branch you type in, for a snippet that uses {{branch}}:

zestssh://snippet?connection=staging-01&name=deploy-branch&var_branch=BRANCH&key=YOUR_API_KEY

Put the shortcut’s variable where BRANCH is. ZestSSH shell-escapes the value, and the question shows the snippet’s command with the value filled in.

  • The app opens: every link opens ZestSSH.
  • No output back to the shortcut: ZestSSH hands nothing back. See the result in More > Automation > Automation history, or use a workflow’s Notify step.
  • Every run asks first: a link waits for Run; a connect link waits for Connect.
  • Link limits: a link of more than 2,048 characters, or with a value of more than 256, is refused. Keep long commands in a snippet.
  • While the app is locked, a link waits until you unlock ZestSSH.