Skip to content

Instantly share code, notes, and snippets.

@npsolution
Forked from luckman212/syno_hb_hcio.sh
Created March 24, 2024 14:42
Show Gist options
  • Save npsolution/5ec7c9de68c4440450ee0ad2d60c12fb to your computer and use it in GitHub Desktop.
Save npsolution/5ec7c9de68c4440450ee0ad2d60c12fb to your computer and use it in GitHub Desktop.
Script to ping healthchecks.io if Synology HyperBackup was successful
#!/usr/bin/env bash
ENDPOINT='https://hc-ping.com/{insert-HealthChecks-UUID-here}'
LOGFILE='/var/log/synolog/synobackup.log'
[[ -e $LOGFILE ]] || exit 1
awk -f- $LOGFILE <<'EOF'
BEGIN {
FS="\t";
TODAY=strftime("%Y/%m/%d");
RETVAL=1;
}
$2 ~ TODAY && $4 ~ /Backup task finished successfully/ {
RETVAL=0;
exit;
}
END {
exit RETVAL;
}
EOF
case $? in
0) curl -s $ENDPOINT;;
*) : ;; #failed
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment