Last active
November 7, 2024 17:39
-
-
Save luckman212/9d751a2b888095573a25ce8296408044 to your computer and use it in GitHub Desktop.
Script to ping healthchecks.io if Synology HyperBackup was successful
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ENDPOINT='https://hc-ping.com/{insert-HealthChecks-UUID-here}' | |
#logfile location changed as of v4.1.2-4039 | |
#LOGFILE='/var/log/synolog/synobackup.log' | |
LOGFILE='/volume1/@appdata/HyperBackup/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
Usage
/volume1/scripts/syno_hb_hcio.sh
ENDPOINT=
line and paste in your UUID URL.https://www.reddit.com/r/synology/comments/t4yzbn/run_a_script_after_hyper_backup_completes/