https://github.com/robinvandernoord/ntfy-log
Very simple CLI tool to log the result of a shell command to ntfy.sh
https://github.com/robinvandernoord/ntfy-log
logging ntfy rust
Last synced: over 1 year ago
JSON representation
Very simple CLI tool to log the result of a shell command to ntfy.sh
- Host: GitHub
- URL: https://github.com/robinvandernoord/ntfy-log
- Owner: robinvandernoord
- Created: 2024-04-01T21:05:51.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-28T15:57:51.000Z (about 2 years ago)
- Last Synced: 2025-01-23T00:26:29.621Z (over 1 year ago)
- Topics: logging, ntfy, rust
- Language: Rust
- Homepage: https://ntfy-log.s3.su6.nl/
- Size: 123 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ntfy-log
Very simple CLI tool to log the result of a shell command to ntfy.sh
## Installation
### Prebuilt binaries
[Intel/AMD 64 bit (x64_64)](https://download.s3.su6.nl/x86_64/ntfy-log)
[ARM (aarch64)](https://download.s3.su6.nl/aarch64/ntfy-log)
### Build from source
```bash
git clone https://github.com/robinvandernoord/ntfy-log.git
cd ntfy-log
cargo build --release
```
## Usage
```bash
# signature
ntfy-log [--endpoint ] [--title ] ...
# example 1 - simple
ntfy-log some-channel ls
# example 2 - advanced
ntfy-log --endpoint ntfy.s3.su6.nl --title "Custom Title" secret-channel ls -alh
```
`--endpoint`: by default this will point to `ntfy.sh`
`--title`: by dfeault this will simply be the command (e.g. `ls` in example 1)
After executing `subcommand`, a JSON result will be sent to the provided topic, with the `command,` `stdout`, `stderr`, and `exit_code`.
If the exit code is non-zero (indicating an error), the priority will be `High`.
In addition, a second message containing simply the `title` is posted to `$topic--success` or `$topic--failure`.
`subcommand` can also be a complex statement (e.g. with pipes (`|`) and logical operators (`&&`, `||`)). Only the final stdout, stderr and exit code are captured (just like you would only see those when running the command normally).
The original stdout and stderr are still printed (unless you pass `--quiet/-q`) and the exit code is forwarded. You can control the output level of `ntfy-log` logs by setting the verbosity level (default: errors only; `-v`: warnings too; `-vv`: informative messages too; `-vvv`: debug messages too; `-vvvv`: stack-trace level logging).
### self-update
You can use the `ntfy-log --self-update` subcommand to download the latest binary (if a newer version is available). This binary will be downloaded from [https://download.s3.su6.nl/].
One can see the currently installed version with `ntfy-log --version`.