added kuma url option

This commit is contained in:
Paul Wilde 2024-03-13 11:24:06 +00:00
parent 12ec6ff5e1
commit 3d063c4912
2 changed files with 29 additions and 5 deletions

View file

@ -15,11 +15,21 @@ $running = get-process | ?{$_.path -eq "C:\Windows\system32\restic.exe"}
Write-Host $running
if ( $running ) {
Write-Host "Backup already running; $running. Exiting..."
curl https://hc-ping.com/$HEALTHCHECK_UUID/fail
if ( $KUMA_ID -ne "" ){
curl https://$KUMA_URL/api/push/$KUMA_ID?status=down&msg=Failed&ping=
}
if ( $HEALTHCHECK_UUID -ne "" ) {
curl https://hc-ping.com/$HEALTHCHECK_UUID/fail
}
exit
}
Write-Host "Not currently running. Continuing..."
curl https://hc-ping.com/$HEALTHCHECK_UUID/start
if ( $KUMA_ID -ne "" ){
curl https://$KUMA_URL/api/push/$KUMA_ID?status=up&msg=Running&ping=
}
if ( $HEALTHCHECK_UUID -ne "" ) {
curl https://hc-ping.com/$HEALTHCHECK_UUID/start
}
if ( $PRE_RUN_SCRIPT ) {
. $dir/$PRE_RUN_SCRIPT
}
@ -27,8 +37,18 @@ Invoke-Expression $BACKUP_CMD
if ( $LastExitCode -eq 0 ) {
if ( $POST_RUN_SCRIPT ) {
. $dir/$POST_RUN_SCRIPT
}
curl https://hc-ping.com/$HEALTHCHECK_UUID
}
if ( $KUMA_ID -ne "" ){
curl https://$KUMA_URL/api/push/$KUMA_ID?status=up&msg=Completed&ping=
}
if ( $HEALTHCHECK_UUID -ne "" ) {
curl https://hc-ping.com/$HEALTHCHECK_UUID
}
} else {
curl https://hc-ping.com/$HEALTHCHECK_UUID/fail
if ( $KUMA_ID -ne "" ){
curl https://$KUMA_URL/api/push/$KUMA_ID?status=down&msg=Failed&ping=
}
if ( $HEALTHCHECK_UUID -ne "" ) {
curl https://hc-ping.com/$HEALTHCHECK_UUID/fail
}
}

View file

@ -8,6 +8,10 @@ $BACKUP_PARAMS=""
$BACKUP_EXCLUDE_FILE=""
# https://healthchecks.io uuid
$HEALTHCHECK_UUID=""
# Uptime Kuma URL
$KUMA_URL=""
# Uptime Kuma push ID
$KUMA_ID=""
# name of a script to run before (ideally in the "pre/" dir)
$PRE_RUN_SCRIPT=""
# name of a script to run after (ideally in the "post/" dir)