feat: add error description in ntfy
This commit is contained in:
+24
-6
@@ -18,12 +18,25 @@ if [ ! -d "$SOURCE" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$(date '+%Y/%m/%d %H:%M:%S') Cloning $SERVICE" >> "$LOG_FILE"
|
echo "$(date '+%Y/%m/%d %H:%M:%S') Starting backup: $SERVICE" >> "$LOG_FILE"
|
||||||
|
|
||||||
rclone sync "$SOURCE" "$REMOTE" --include "$FILTER" --max-age "$MAX_AGE" \
|
SYNC_ERROR=$(rclone sync "$SOURCE" "$REMOTE" \
|
||||||
--bwlimit "$BW_LIMIT" --delete-before --delete-excluded --yandex-hard-delete --checksum -q 2>> "$LOG_FILE"
|
--include "$FILTER" \
|
||||||
|
--max-age "$MAX_AGE" \
|
||||||
|
--bwlimit "$BW_LIMIT" \
|
||||||
|
--delete-before \
|
||||||
|
--delete-excluded \
|
||||||
|
--checksum $YANDEX_OPTS \
|
||||||
|
-q 2>&1)
|
||||||
|
|
||||||
CHECK_OUT=$(rclone check "$SOURCE" "$REMOTE" --include "$FILTER" --max-age "$MAX_AGE" --one-way 2>&1)
|
if [ -n "$SYNC_ERROR" ]; then
|
||||||
|
echo "[SYNC ERROR] $SYNC_ERROR" >> "$LOG_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
CHECK_OUT=$(rclone check "$SOURCE" "$REMOTE" \
|
||||||
|
--include "$FILTER" \
|
||||||
|
--max-age "$MAX_AGE" \
|
||||||
|
--one-way 2>&1)
|
||||||
|
|
||||||
echo "$CHECK_OUT" >> "$LOG_FILE"
|
echo "$CHECK_OUT" >> "$LOG_FILE"
|
||||||
|
|
||||||
@@ -38,7 +51,7 @@ TAGS="warning"
|
|||||||
PRIORITY="high"
|
PRIORITY="high"
|
||||||
MSG_PREFIX="Check failed"
|
MSG_PREFIX="Check failed"
|
||||||
|
|
||||||
if [ "$DIFFS" = "0" ] && ! echo "$CHECK_OUT" | grep -iq "error"; then
|
if [ -z "$SYNC_ERROR" ] && [ "$DIFFS" = "0" ] && ! echo "$CHECK_OUT" | grep -iq "error"; then
|
||||||
STATUS="SUCCESS"
|
STATUS="SUCCESS"
|
||||||
TAGS="white_check_mark"
|
TAGS="white_check_mark"
|
||||||
PRIORITY="default"
|
PRIORITY="default"
|
||||||
@@ -50,9 +63,14 @@ Matching: $MATCH
|
|||||||
Differences: $DIFFS
|
Differences: $DIFFS
|
||||||
Storage: $REMOTE"
|
Storage: $REMOTE"
|
||||||
|
|
||||||
|
if [ -n "$SYNC_ERROR" ]; then
|
||||||
|
MESSAGE="$MESSAGE
|
||||||
|
$SYNC_ERROR"
|
||||||
|
fi
|
||||||
|
|
||||||
curl -s -u "$AUTH" \
|
curl -s -u "$AUTH" \
|
||||||
-H "Title: $SERVICE Backup: $STATUS" \
|
-H "Title: $SERVICE Backup: $STATUS" \
|
||||||
-H "Priority: $PRIORITY" \
|
-H "Priority: $PRIORITY" \
|
||||||
-H "Tags: $TAGS" \
|
-H "Tags: $TAGS" \
|
||||||
-d "$MESSAGE" \
|
-d "$MESSAGE" \
|
||||||
"$NTFY_URL" > /dev/null
|
"$NTFY_URL" > /dev/null
|
||||||
Reference in New Issue
Block a user