Update examples
This commit is contained in:
parent
9d37217eba
commit
1e7ae885b4
3 changed files with 8 additions and 2 deletions
|
@ -2,6 +2,8 @@
|
|||
# This is an example shell script showing how to consume a ntfy.sh topic using
|
||||
# a simple script. The notify-send command sends any arriving message as a desktop notification.
|
||||
|
||||
TOPIC_URL=ntfy.sh/mytopic
|
||||
|
||||
while read msg; do
|
||||
[ -n "$msg" ] && notify-send "$msg"
|
||||
done < <(stdbuf -i0 -o0 curl -s ntfy.sh/mytopic/raw)
|
||||
done < <(stdbuf -i0 -o0 curl -s $TOPIC_URL/raw)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
# This is a PAM script hook that shows how to notify you when
|
||||
# somebody logs into your server. Place at /usr/local/bin/ntfy-ssh-login.sh (with chmod +x!).
|
||||
|
||||
TOPIC_URL=ntfy.sh/alerts
|
||||
|
||||
if [ "${PAM_TYPE}" = "open_session" ]; then
|
||||
echo -en "\u26A0\uFE0F SSH login to $(hostname): ${PAM_USER} from ${PAM_RHOST}" | curl -T- ntfy.sh/alerts
|
||||
curl -H tags:warning -H prio:high -d "SSH login to $(hostname): ${PAM_USER} from ${PAM_RHOST}" "${TOPIC_URL}"
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue