various
parent
3fd25c3e59
commit
930a21ccca
usr/local/bin
|
@ -179,12 +179,34 @@ function invoke_script() {
|
|||
exec 3>&1
|
||||
|
||||
script_output=$("$backup_scripts_dir/$backup_script_filename" 2>&1 | tee /dev/fd/3)
|
||||
echo "$?"
|
||||
|
||||
if [[ "$?" == 0 ]]; then
|
||||
trigger_notify "success" "Backup Successful: $backup_script_name" "$script_output"
|
||||
else
|
||||
trigger_notify "error" "Backup Failed: $backup_script_name" "$script_output"
|
||||
fi
|
||||
|
||||
set +o pipefail
|
||||
exec 3>&-
|
||||
}
|
||||
|
||||
function trigger_notify() {
|
||||
level="$1"
|
||||
title="$2"
|
||||
output="$3"
|
||||
notify_prog="/usr/local/bin/sh.zio.notify"
|
||||
|
||||
if [[ ! -f "$notify_prog" ]]; then
|
||||
say warning "'$notify_prog' not found. Not sending notification"
|
||||
else
|
||||
/usr/local/bin/sh.zio.notify
|
||||
--invoked-by "sh.zio.backup" \
|
||||
--level "$level" \
|
||||
--message '```\\n'"${output//$'\n'/'\\n'}"'\\n```' \
|
||||
--title "$title"
|
||||
fi
|
||||
}
|
||||
|
||||
function backup_files() {
|
||||
patterns="$1"
|
||||
args="${@:2}"
|
||||
|
|
Loading…
Reference in New Issue