update backup script to use RocketChat
This commit is contained in:
parent
47b4b347de
commit
e431ea117d
1 changed files with 6 additions and 7 deletions
|
@ -11,19 +11,18 @@ export XDG_RUNTIME_DIR=/run/user/1000
|
|||
source /home/thomas/.env
|
||||
|
||||
SCHEDULE=$1
|
||||
THIS_FILE=${0}
|
||||
SLACK_NOTIFIER="${HOME}/repos/utilities/slack_notifier.sh"
|
||||
# SLACK_NOTIFIER="${HOME}/repos/utilities/slack_notifier.sh"
|
||||
RCHAT_NOTIFIER="${HOME}/repos/utilities/rocketchat_notifier.sh"
|
||||
|
||||
if mountpoint -q /media/samsung-T3; then
|
||||
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"
|
||||
$RCHAT_NOTIFIER "backups" "error" "${SCHEDULE} /home backup failed: ${ERROR}"
|
||||
else
|
||||
$SLACK_NOTIFIER "backups" "success" "${SCHEDULE} /home backup completed"
|
||||
$RCHAT_NOTIFIER "backups" "success" "${SCHEDULE} /home backup completed"
|
||||
fi
|
||||
else
|
||||
$SLACK_NOTIFIER "backups" "error" \
|
||||
"${SCHEDULE} /home backup failed" "disk not mounted" \
|
||||
"$THIS_FILE"
|
||||
$RCHAT_NOTIFIER "backups" "error" \
|
||||
"${SCHEDULE} /home backup failed: disk not mounted"
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue