97fdb926ac
- homey-alert: add a global PreToolUse hook that transparently times every Bash command Claude runs and fires a notification once a command crosses the configured threshold (default 5 min), without needing the skill to be invoked manually. Also makes homey-alert always fire a local notify-send alongside the ntfy push, since the ntfy server isn't always reachable. - nextcloud: fix sleep crash-loop under the restricted systemd PATH (bin/sleep -> coreutils store path). - azos-core bump (adds ncdu to the base suite).
66 lines
2.7 KiB
Markdown
66 lines
2.7 KiB
Markdown
# Homey Alert — sending ntfy notifications when tasks finish
|
|
|
|
Use `homey-alert` to push notifications to Aner's homelab ntfy server when long tasks complete.
|
|
|
|
## When to use proactively
|
|
|
|
When running (or suggesting) a command that will take more than ~30 seconds — training runs,
|
|
builds, deploys, downloads, test suites — append a notification automatically. Don't wait to
|
|
be asked.
|
|
|
|
## Background / async tasks (Claude Code specifically)
|
|
|
|
If you (the agent) are running a command via Bash that could take longer than
|
|
~10 minutes — large rclone/rsync transfers, builds, training runs — and it
|
|
might run in the background (either because you set `run_in_background`, or
|
|
because the harness auto-backgrounds it after its timeout), chain the
|
|
`homey-alert` call **into that same command string from the start**. Don't
|
|
wait until you notice it's taking a while and then think about notifying —
|
|
by then the command is already running without it, and the harness's own
|
|
"task finished" signal only reaches this session, not Aner's phone. Chaining
|
|
upfront is the only way to get a real ntfy push the moment it actually
|
|
finishes:
|
|
|
|
```bash
|
|
rclone copy ... ; homey-alert -t "Backup" -p default -T "$([ $? -eq 0 ] && echo white_check_mark || echo x)" "rclone copy finished (exit $?)"
|
|
```
|
|
|
|
## Local commands
|
|
|
|
Append after the command so it fires on success only (`&&`) or always (`;`):
|
|
|
|
```bash
|
|
# Notify on success only
|
|
long_cmd && homey-alert "Task done"
|
|
|
|
# Always notify (even on failure) — prefer this for deploys/training
|
|
long_cmd; homey-alert -t "Training" -p high -T "$([ $? -eq 0 ] && echo white_check_mark || echo x)" "Exited $?"
|
|
```
|
|
|
|
## Remote commands (SSH / training machines)
|
|
|
|
Remote machines don't have `homey-alert`. Use `-r`/`--print-remote` to get a self-contained
|
|
`curl` command with the token already embedded. The `$(...)` expands **locally**; the resulting
|
|
command string is what the remote machine executes.
|
|
|
|
```bash
|
|
ssh user@host "python train.py && $(homey-alert -r -t 'Training' -p high -T white_check_mark 'Model finished')"
|
|
```
|
|
|
|
The remote machine only needs `curl` (universally available).
|
|
|
|
## Flags
|
|
|
|
| Flag | Short | Values / notes |
|
|
|------|-------|----------------|
|
|
| `--title TITLE` | `-t` | Notification title |
|
|
| `--priority PRIO` | `-p` | `min` / `low` / `default` / `high` / `urgent` |
|
|
| `--tags TAGS` | `-T` | Comma-separated emoji shortcodes: `white_check_mark`, `x`, `warning`, `rotating_light`, `tada` |
|
|
| `--print-remote` | `-r` | Print curl command instead of running (embed token locally, run remotely) |
|
|
|
|
## Choosing priority and tags
|
|
|
|
- Routine completion (backup, build): `default` priority, `white_check_mark`
|
|
- Training / long job: `high` priority, `white_check_mark` on success / `x` on failure
|
|
- Something broke: `urgent` priority, `rotating_light`
|