Skip to content

Instantly share code, notes, and snippets.

@matthewpick
Created January 24, 2026 20:59
Show Gist options
  • Select an option

  • Save matthewpick/2a0362d25463bdd3a05d6de6fd63c446 to your computer and use it in GitHub Desktop.

Select an option

Save matthewpick/2a0362d25463bdd3a05d6de6fd63c446 to your computer and use it in GitHub Desktop.
Push Synology HyperBackup stats to Uptime Kuma
info 2026/01/22 04:00:03 SYSTEM: [Network][TASK_NAME_HERE] Backup task started.
info 2026/01/22 04:04:27 SYSTEM: [Network][TASK_NAME_HERE] Backup task finished successfully. [84 files scanned] [3 new files] [11 files modified] [70 files unchanged]
info 2026/01/23 04:00:02 SYSTEM: [Network][TASK_NAME_HERE] Backup task started.
info 2026/01/23 04:05:43 SYSTEM: [Network][TASK_NAME_HERE] Backup task finished successfully. [87 files scanned] [3 new files] [11 files modified] [73 files unchanged]
info 2026/01/24 04:00:02 SYSTEM: [Network][TASK_NAME_HERE] Backup task started.
info 2026/01/24 04:11:45 SYSTEM: [Network][TASK_NAME_HERE] Backup task finished successfully. [88 files scanned] [2 new files] [10 files modified] [76 files unchanged]

Synology Hyper Backup → Uptime Kuma Notification

A simple script to notify Uptime Kuma when a Synology Hyper Backup task completes successfully.

Setup

1. Create a Push Monitor in Uptime Kuma

  • Add a new monitor with type Push
  • Set Heartbeat Interval to 90000 (25 hours) for daily backups
  • Copy your Push URL

2. Create a Scheduled Task in DSM

  1. Open Control PanelTask Scheduler
  2. CreateScheduled TaskUser-defined script
  3. Set User to root
  4. Set Schedule to run daily, ~30 minutes after your backup typically finishes
  5. In Task Settings, paste the script (update the URL and task name)

What It Does

  • Checks today's Hyper Backup log for a successful completion
  • Sends a push notification to Uptime Kuma with backup stats
  • Message includes: files scanned, new files, modified files, and start/end times

Example Output

88 scanned, 2 new, 10 mod (04:00:02-04:11:45)
#!/bin/bash
UPTIME_KUMA_URL="https://your-uptime-kuma/api/push/YOUR_TOKEN"
TASK_NAME="TASK_NAME_HERE"
LOG_FILE="/var/log/synolog/synobackup.log"
TODAY=$(date +%Y/%m/%d)
# Get today's finished line for this task
FINISHED_LINE=$(grep "$TODAY" "$LOG_FILE" | grep "$TASK_NAME" | grep "finished successfully" | tail -1)
if [ -z "$FINISHED_LINE" ]; then
exit 1
fi
START_LINE=$(grep "$TODAY" "$LOG_FILE" | grep "$TASK_NAME" | grep "started" | tail -1)
# Extract times
START_TIME=$(echo "$START_LINE" | awk '{print $3}')
END_TIME=$(echo "$FINISHED_LINE" | awk '{print $3}')
# Extract file stats
FILES_SCANNED=$(echo "$FINISHED_LINE" | grep -oP '\[\K[0-9]+(?= files scanned\])')
NEW_FILES=$(echo "$FINISHED_LINE" | grep -oP '\[\K[0-9]+(?= new files\])')
MODIFIED=$(echo "$FINISHED_LINE" | grep -oP '\[\K[0-9]+(?= files modified\])')
# Build message
MSG="${FILES_SCANNED} scanned, ${NEW_FILES} new, ${MODIFIED} mod (${START_TIME}-${END_TIME})"
# Send to Uptime Kuma
curl -s "${UPTIME_KUMA_URL}?status=up&msg=$(echo "$MSG" | sed 's/ /%20/g')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment