diff --git a/home_backup.sh b/home_backup.sh index 050c454..e014dcb 100755 --- a/home_backup.sh +++ b/home_backup.sh @@ -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" diff --git a/slack_notifier.sh b/slack_notifier.sh index 1da0a57..654563b 100755 --- a/slack_notifier.sh +++ b/slack_notifier.sh @@ -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,14 +74,14 @@ if [ "$2" != "error" ]; then -H 'Content-type: application/json' \ --data '{"text":"🟢 '"$3"'"}' \ "$WEBHOOK" - mpv --volume=100 "${HOME}/dotfiles/sounds/star-trek-computer-success.mp3" \ - >/dev/null 2>&1 + # mpv --volume=100 "${HOME}/dotfiles/sounds/star-trek-computer-success.mp3" \ + >/dev/null 2>&1 else curl -X POST \ -H 'Content-type: application/json' \ --json "$ERROR_BLOCKS" \ "$WEBHOOK" - mpv --volume=100 "${HOME}/dotfiles/sounds/star-trek-computer-error.mp3" \ - >/dev/null 2>&1 + # mpv --volume=100 "${HOME}/dotfiles/sounds/star-trek-computer-error.mp3" \ + >/dev/null 2>&1 fi