Skip to content

Tasker Examples

These examples show complete Tasker task configurations for common ZestSSH automation scenarios. Replace YOUR_KEY with your actual API key and connection labels with your own.

Goal: Every morning, check disk usage on a web server and notify if above 80%.

  • Trigger: Time > Every Day at 07:00

Action 1 --- Browse URL:

URL: zestssh://execute?connection=WebServer&command=df -h / | awk 'NR==2{print $5}' | tr -d '%'&key=YOUR_KEY&timeout=15

Action 2 --- Wait: 5 seconds (allow ZestSSH to execute)

Action 3 --- Variable Set:

  • Name: %disk_usage
  • To: %stdout

Action 4 --- If: %disk_usage > 80

Action 5 --- Notify:

  • Title: “Disk Warning”
  • Text: “WebServer disk at %disk_usage%”

Action 6 --- End If

Alternative Using Intent (More Reliable Result Handling)

Section titled “Alternative Using Intent (More Reliable Result Handling)”

Action 1 --- Send Intent:

  • Action: com.affluentlabs.zestssh.EXECUTE
  • Extra: connection_id:WebServer
  • Extra: command:df -h / | awk 'NR==2{print $5}' | tr -d '%'
  • Extra: key:YOUR_KEY
  • Extra: timeout:15
  • Target: Service

The intent returns %stdout with the disk percentage and %exit_code with 0 or 1.

Example 2: Backup Trigger on Wi-Fi Disconnect

Section titled “Example 2: Backup Trigger on Wi-Fi Disconnect”

Goal: When you leave home (disconnect from home Wi-Fi), trigger a backup script on your NAS.

  • Trigger: State > Net > Wi-Fi Connected
  • Invert: Yes (triggers on disconnect)
  • SSID: “HomeNetwork”

Action 1 --- Browse URL:

URL: zestssh://execute?connection=NAS&command=sudo /opt/scripts/backup.sh&key=YOUR_KEY&timeout=600

Action 2 --- Notify:

  • Title: “Backup Started”
  • Text: “NAS backup triggered (leaving home)“

To receive a notification when the backup finishes:

URL: zestssh://execute?connection=NAS&command=sudo /opt/scripts/backup.sh&key=YOUR_KEY&timeout=600&callback=https://ntfy.sh/your-backup-topic

The callback posts results to ntfy.sh (or any HTTPS endpoint) so you get a push notification when the backup completes.

Example 3: Deploy Script with Branch Variable

Section titled “Example 3: Deploy Script with Branch Variable”

Goal: Trigger a deployment to staging with a specific branch, using a snippet with variable substitution.

Create a snippet named “deploy-branch” with the command:

Terminal window
cd /var/www/app && git fetch && git checkout {{branch}} && git pull && docker compose up -d --build

Action 1 --- Variable Set:

  • Name: %deploy_branch
  • To: develop (or prompt with Input Dialog)

Action 2 --- Browse URL:

URL: zestssh://snippet?connection=StagingServer&name=deploy-branch&var_branch=%deploy_branch&key=YOUR_KEY

Action 3 --- Notify:

  • Title: “Deploy Triggered”
  • Text: “Deploying %deploy_branch to staging”

Goal: Run apt update && apt upgrade -y on three servers simultaneously.

Action 1 --- Browse URL:

URL: zestssh://batch?connections=Web1,Web2,DB1&command=sudo apt update -qq && sudo apt upgrade -y -qq&key=YOUR_KEY&parallel=true&timeout=120

The batch action runs the command on all three servers concurrently. The combined output shows results per server.

Action 2 --- Send Intent (for result):

  • Action: com.affluentlabs.zestssh.EXECUTE
  • Extra: connection_id:Web1
  • Extra: command:cat /var/run/reboot-required 2>/dev/null && echo "REBOOT NEEDED" || echo "No reboot needed"
  • Extra: key:YOUR_KEY

Action 3 --- If: %stdout ~ REBOOT NEEDED

Action 4 --- Notify:

  • Title: “Reboot Required”
  • Text: “Web1 needs a reboot after updates”

Action 5 --- End If

Goal: Every hour, check if key Docker containers are running and alert if any are down.

  • Trigger: Time > Every 1 Hour

Action 1 --- Browse URL:

URL: zestssh://execute?connection=DockerHost&command=docker ps --format '{{.Names}} {{.Status}}' | grep -v "Up"&key=YOUR_KEY&timeout=15

The grep -v "Up" filters to show only containers that are NOT running.

Action 2 --- Wait: 3 seconds

Action 3 --- If: %stdout is set (non-empty means some containers are down)

Action 4 --- Notify:

  • Title: “Container Alert”
  • Text: “Containers down:\n%stdout”
  • Priority: High

Action 5 --- End If

Instead of putting grep in the command itself, you can use ZestSSH’s built-in output filter:

URL: zestssh://execute?connection=DockerHost&command=docker ps --format '{{.Names}} {{.Status}}'&grep=Exited&key=YOUR_KEY

The grep=Exited parameter filters the output to show only containers with “Exited” in their status line.

  • Use Variable Set to store the API key once and reference %zest_key in all tasks, rather than pasting the raw key into every URL.
  • URL encoding: Tasker handles basic URL encoding, but complex commands with special characters (&, =, %) may need manual encoding. Use %26 for &, %3D for = in command strings.
  • Wait actions: When using Browse URL, add a short Wait action (3-5 seconds) before checking results, since Browse URL returns immediately after opening the URL.
  • Intent method is more reliable for result handling. The Browse URL method is simpler to set up but does not reliably return stdout to Tasker variables.
  • Test commands manually in ZestSSH’s terminal before automating them to make sure they produce the expected output.