XylotrechusZ

XylotrechusZ Shell

: /home/matican/.acme.sh/notify/ [ drwxrwxr-x ]
Uname: Linux premium72.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software: LiteSpeed
PHP version: 8.2.29 [ PHP INFO ] PHP os: Linux
Server Ip: 198.54.125.95
Your Ip: 216.73.216.35
User: matican (532) | Group: matican (531)
Safe Mode: OFF
Disable Function:
NONE

name : ntfy.sh
#!/bin/bash

# support ntfy

#NTFY_URL="https://ntfy.sh"
#NTFY_TOPIC="xxxxxxxxxxxxx"

ntfy_send() {
  _subject="$1"
  _content="$2"
  _statusCode="$3" #0: success, 1: error 2($RENEW_SKIP): skipped
  _debug "_subject" "$_subject"
  _debug "_content" "$_content"
  _debug "_statusCode" "$_statusCode"

  NTFY_URL="${NTFY_URL:-$(_readaccountconf_mutable NTFY_URL)}"
  if [ "$NTFY_URL" ]; then
    _saveaccountconf_mutable NTFY_URL "$NTFY_URL"
  fi

  NTFY_TOPIC="${NTFY_TOPIC:-$(_readaccountconf_mutable NTFY_TOPIC)}"
  if [ "$NTFY_TOPIC" ]; then
    _saveaccountconf_mutable NTFY_TOPIC "$NTFY_TOPIC"
  fi

  _data="${_subject}. $_content"
  response="$(_post "$_data" "$NTFY_URL/$NTFY_TOPIC" "" "POST" "")"

  if [ "$?" = "0" ] && _contains "$response" "expires"; then
    _info "ntfy event fired success."
    return 0
  fi

  _err "ntfy event fired error."
  _err "$response"
  return 1
}
© 2025 XylotrechusZ