Skip to content

Very simple CLI tool to log the result of a shell command to ntfy.sh

Notifications You must be signed in to change notification settings

robinvandernoord/ntfy-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)
ARM (aarch64)

Build from source

git clone https://github.com/robinvandernoord/ntfy-log.git
cd ntfy-log
cargo build --release

Usage

# signature
ntfy-log <topic> [--endpoint <endpoint>] [--title <title>] <subcommand>...

# 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.

About

Very simple CLI tool to log the result of a shell command to ntfy.sh

Topics

Resources

Stars

Watchers

Forks