diff --git a/backup.ps1 b/backup.ps1 index 58db102..629522a 100644 --- a/backup.ps1 +++ b/backup.ps1 @@ -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 + } } diff --git a/env.sample.ps1 b/env.sample.ps1 index cf096bd..903e919 100644 --- a/env.sample.ps1 +++ b/env.sample.ps1 @@ -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)