2
0
Fork 0

sh.zio.backup: modify notification title

main
Ducky 2024-04-01 21:49:52 +01:00
parent 5f58607a4e
commit 414f199766
1 changed files with 3 additions and 6 deletions

View File

@ -181,9 +181,9 @@ function invoke_script() {
script_output=$("$backup_scripts_dir/$backup_script_filename" 2>&1 | tee /dev/fd/3) script_output=$("$backup_scripts_dir/$backup_script_filename" 2>&1 | tee /dev/fd/3)
if [[ "$?" == 0 ]]; then if [[ "$?" == 0 ]]; then
trigger_notify "success" "Backup Successful: $backup_script_name" "$script_output" trigger_notify "success" "Backup script succeeded: $backup_script_name" "$script_output"
else else
trigger_notify "error" "Backup Failed: $backup_script_name" "$script_output" trigger_notify "error" "Backup script failed: $backup_script_name" "$script_output"
fi fi
set +o pipefail set +o pipefail
@ -194,15 +194,12 @@ function trigger_notify() {
level="$1" level="$1"
title="$2" title="$2"
output="$(echo "$3" | sed -r "s/\x1B\[[0-9;]*[JKmsu]//g")" output="$(echo "$3" | sed -r "s/\x1B\[[0-9;]*[JKmsu]//g")"
#output="yo"
notify_prog="/usr/local/bin/sh.zio.notify" notify_prog="/usr/local/bin/sh.zio.notify"
echo "THE OUTPUT: $output"
if [[ ! -f "$notify_prog" ]]; then if [[ ! -f "$notify_prog" ]]; then
say warning "'$notify_prog' not found. Not sending notification" say warning "'$notify_prog' not found. Not sending notification"
else else
/usr/local/bin/sh.zio.notify \ "$notify_prog" \
--level "$level" \ --level "$level" \
--message '```\\n'"${output//$'\n'/'\\n'}"'\\n```' \ --message '```\\n'"${output//$'\n'/'\\n'}"'\\n```' \
--title "$title" --title "$title"