You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If options are not set in zed.rc then default back to normal prority and defualt notification sound.
zed_notify_pushover()
{
local subject="$1"
local pathname="${2:-"/dev/null"}"
local msg_body
local msg_out
local msg_err
local url="https://api.pushover.net/1/messages.json"
# --- NEW: Default values for priority and sound ---
# These are used if ZED_PUSHOVER_PRIORITY or ZED_PUSHOVER_SOUND are not set in zed.rc
local DEFAULT_PRIORITY="0" # Default to normal priority
local DEFAULT_SOUND="pushover" # Default Pushover sound
# --- NEW: Determine final priority and sound to use ---
# Use ZED_PUSHOVER_PRIORITY if it's set and not empty, otherwise use DEFAULT_PRIORITY
local final_priority="${ZED_PUSHOVER_PRIORITY:-${DEFAULT_PRIORITY}}"
# Use ZED_PUSHOVER_SOUND if it's set and not empty, otherwise use DEFAULT_SOUND
local final_sound="${ZED_PUSHOVER_SOUND:-${DEFAULT_SOUND}}"
[ -n "${ZED_PUSHOVER_TOKEN}" ] && [ -n "${ZED_PUSHOVER_USER}" ] || return 2
if [ ! -r "${pathname}" ]; then
zed_log_err "pushover cannot read \"${pathname}\""
return 1
fi
zed_check_cmd "curl" "sed" || return 1
# Read the message body in.
#
msg_body="$(cat "${pathname}")"
if [ -z "${msg_body}" ]
then
msg_body=$subject
subject=""
fi
# Send the POST request and check for errors.
#
msg_out="$( \
curl \
--form-string "token=${ZED_PUSHOVER_TOKEN}" \
--form-string "user=${ZED_PUSHOVER_USER}" \
--form-string "message=${msg_body}" \
--form-string "title=${subject}" \
--form-string "priority=${final_priority}" \
--form-string "sound=${final_sound}" \
"${url}" \
2>/dev/null \
)"; rv=$?
if [ "${rv}" -ne 0 ]; then
zed_log_err "curl exit=${rv}"
return 1
fi
msg_err="$(echo "${msg_out}" \
| sed -n -e 's/.*"errors" *:.*\[\(.*\)\].*/\1/p')"
if [ -n "${msg_err}" ]; then
zed_log_err "pushover \"${msg_err}"\"
return 1
fi
return 0
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Add variables to zed.rc file (example of changing to high prority and longer notification sound.
Edit the function in zed-functions.sh
If options are not set in zed.rc then default back to normal prority and defualt notification sound.
Tested on Ubuntu 24 with ZFS 2.2.2
Beta Was this translation helpful? Give feedback.
All reactions