usm notify¶
Wrap a command and ping every configured channel when it finishes. Useful for "I trained overnight, did it actually succeed?" and "did the deploy finish?" cases.
usm notify -- python train.py # wrap a command
usm notify --on fail -- ./long-job.sh # ping only on non-zero
usm notify --on success -- ./flaky-deploy.sh
usm notify --tag "model-x" -- bash -c 'sleep 5; false'
Channels¶
Configure each one once with usm notify config <channel> .... Multiple
channels can be active at the same time — every notification fans out.
Free push notifications without auth (your topic IS the secret — pick something unguessable).
usm notify config ntfy --topic my-very-secret-topic-123
usm notify config ntfy --topic mytopic --server https://ntfy.example.com
usm notify config ntfy --topic mytopic --priority 4 --tags warning,robot
Then install the ntfy mobile app and subscribe to the same topic.
Create a bot via @BotFather, then ask @userinfobot for your chat id.
Default payload is {"text": "<title>\n<message>"}, which is what
Slack / Discord-compatible webhooks expect.
For Lark / Feishu, pass a custom payload template; {title} and
{message} are interpolated:
Other subcommands¶
usm notify config show # show active channels (tokens redacted)
usm notify config clear ntfy # remove a channel
usm notify test # send "hello" through every channel
What the notification contains¶
- Title:
[hostname] <tag-or-cmd-prefix> — OK|FAILED (rc) in <elapsed> - Body: the last
--tail Nlines of the wrapped command's stderr (default 20). The full stderr still streams to your terminal in real time — the notification only includes the tail.
Config file¶
~/.config/usm/notify.json (chmod 600). Plaintext — don't share it.