[GH-ISSUE #1324] How does ntfy/curl know if command ended successfully? #937

Closed
opened 2026-05-07 00:28:55 +02:00 by BreizhHardware · 1 comment

Originally created by @lockheed on GitHub (Apr 28, 2025).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1324

Question

I am just getting into setting up ntfy using "&&" and "||" but it would help to know how does curl or ntfy know a particular command ended successfully or in error.
For example
ping google.com || curl -d "Pinging google failed!" ntfy.src.com/ping

Does it look for "error" in output, or is it something else?

Originally created by @lockheed on GitHub (Apr 28, 2025). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1324 :question: **Question** <!-- Go ahead and ask your question here :) --> I am just getting into setting up ntfy using "&&" and "||" but it would help to know how does curl or ntfy know a particular command ended successfully or in error. For example `ping google.com || curl -d "Pinging google failed!" ntfy.src.com/ping` Does it look for "error" in output, or is it something else?
BreizhHardware 2026-05-07 00:28:55 +02:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@wunter8 commented on GitHub (Apr 28, 2025):

This depends on the specific shell language you're using. For example, that syntax could depend on how bash interprets whether a command succeeded or not (based on an exit code of the program).

So in this case, if ping exits successfully (with an exit code of 0), curl will not run. If ping fails (with a non-zero exit code), curl will run

<!-- gh-comment-id:2835790332 --> @wunter8 commented on GitHub (Apr 28, 2025): This depends on the specific shell language you're using. For example, that syntax could depend on how `bash` interprets whether a command succeeded or not (based on an exit code of the program). So in this case, if `ping` exits successfully (with an exit code of `0`), `curl` will not run. If `ping` fails (with a non-zero exit code), `curl` will run
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#937
No description provided.