remove sound from notifications

This commit is contained in:
thomasabishop 2025-04-06 16:06:10 +01:00
parent 1d944cc6ec
commit bbbf25a70e
2 changed files with 13 additions and 12 deletions

View file

@ -5,16 +5,17 @@
# Parameters
# --- $1 = Time schedule ('hourly' | 'daily' | 'weekly' | 'monthly')
#USER=thomas
#export XDG_RUNTIME_DIR=/run/user/1000
#source /home/thomas/.env
USER=thomas
export HOME=/home/thomas
export XDG_RUNTIME_DIR=/run/user/1000
source /home/thomas/.env
SCHEDULE=$1
THIS_FILE=${0}
SLACK_NOTIFIER="${HOME}/repos/utilities/slack_notifier.sh"
if mountpoint -q /media/samsung-T3; then
ERROR=$(sudo /usr/bin/rsnapshot -c /etc/rsnapshot.conf hourly 2>&1)
ERROR=$(sudo /usr/bin/rsnapshot -c /etc/rsnapshot.conf "$SCHEDULE" 2>&1)
STATUS=$?
if [ $STATUS -ne 0 ]; then
$SLACK_NOTIFIER "backups" "error" "${SCHEDULE} /home backup failed" "$ERROR" "$THIS_FILE"

View file

@ -1,6 +1,6 @@
#!/bin/bash
# Send error and success notifications to Slack channels and play sound
# Send error and success notifications to Slack channels
# Env vars:
# --- Webhook URLs for given channel, eg $SLACK_WEBHOOK_TEST, $SLACK_WEBHOOK_EOLAS
@ -64,9 +64,9 @@ ERROR_BLOCKS=$(
# Initialise sound playback
mpv --volume=0 --start=0 --length=0.1 "${HOME}/dotfiles/sounds/star-trek-computer-success.mp3" \
>/dev/null 2>&1
sleep 1
# mpv --volume=0 --start=0 --length=0.1 "${HOME}/dotfiles/sounds/star-trek-computer-success.mp3" \
# >/dev/null 2>&1
# sleep 1
# Process notification
if [ "$2" != "error" ]; then
@ -74,7 +74,7 @@ if [ "$2" != "error" ]; then
-H 'Content-type: application/json' \
--data '{"text":"🟢 '"$3"'"}' \
"$WEBHOOK"
mpv --volume=100 "${HOME}/dotfiles/sounds/star-trek-computer-success.mp3" \
# mpv --volume=100 "${HOME}/dotfiles/sounds/star-trek-computer-success.mp3" \
>/dev/null 2>&1
else
@ -82,6 +82,6 @@ else
-H 'Content-type: application/json' \
--json "$ERROR_BLOCKS" \
"$WEBHOOK"
mpv --volume=100 "${HOME}/dotfiles/sounds/star-trek-computer-error.mp3" \
# mpv --volume=100 "${HOME}/dotfiles/sounds/star-trek-computer-error.mp3" \
>/dev/null 2>&1
fi